Jump to content

Multple Page PDFs with Insert Picture Rule?


dhealy72

Recommended Posts

Or, more generally, to return all the pages from a PDF:

var result = [];
var r = CreateResource("FileName.pdf", "graphic");
for (var p = 1; p <= r.countPages; p++)
{
   r.pagenumber = p;
   result.push(r.content);
}
return result.join("<br>\n");

Note the addition of the second parameter to the CreateResource function denoting that you want to create a graphic resource.

 

Also, a search of this forum for terms such as "multipage PDF" or "multiple page PDF" returns plenty of hits, including this example:

http://forums.pti.com/showthread.php?t=37

Link to comment
Share on other sites

Or, more generally, to return all the pages from a PDF:

var result = [];
var r = CreateResource("FileName.pdf", "graphic");
for (var p = 1; p <= r.countPages; p++)
{
   r.pagenumber = p;
   result.push(r.content);
}
return result.join("<br>\n");

Note the addition of the second parameter to the CreateResource function denoting that you want to create a graphic resource.

 

Also, a search of this forum for terms such as "multipage PDF" or "multiple page PDF" returns plenty of hits, including this example:

http://forums.pti.com/showthread.php?t=37

 

 

I have tried your rule and I get an error trying either text or graphic rule.

 

When I insert your code in a graphic rule, I get the error "This Graphic rule must return a Resource of type graphic".

 

When I insert your code in a text rule, I get nothing when composed with the "Re-evaluate this rule for every text flow" and "Treat returned strings as tagged text" checked. If I uncheck those two boxes I get actual text of my graphic name and page numbers.

 

What am I doing wrong?TIA

Link to comment
Share on other sites

I have tried your rule and I get an error trying either text or graphic rule.

 

When I insert your code in a graphic rule, I get the error "This Graphic rule must return a Resource of type graphic".

 

When I insert your code in a text rule, I get nothing when composed with the "Re-evaluate this rule for every text flow" and "Treat returned strings as tagged text" checked. If I uncheck those two boxes I get actual text of my graphic name and page numbers.

 

What am I doing wrong?TIA

You need to use a Text rule, with the "Treat returned strings as tagged text" box checked, and call out the rule in a text frame which is large enough to hold a page of the graphic, and which overflows to new pages. Try the example job in the thread I quoted before. Also, look at the log file for any messages about content not fitting in the flow.

Link to comment
Share on other sites

You need to use a Text rule, with the "Treat returned strings as tagged text" box checked, and call out the rule in a text frame which is large enough to hold a page of the graphic, and which overflows to new pages. Try the example job in the thread I quoted before. Also, look at the log file for any messages about content not fitting in the flow.

 

OK so when I validate the rule I get this(this is just a sample of it):

 

<graphic file="Main_v1.pdf" pagenumber="1" /><br>

<graphic file="Main_v1.pdf" pagenumber="2" /><br>

<graphic file="Main_v1.pdf" pagenumber="3" /><br>

<graphic file="Main_v1.pdf" pagenumber="4" /><br>

<graphic file="Main_v1.pdf" pagenumber="5" /><br>

<graphic file="Main_v1.pdf" pagenumber="6" /><br>

<graphic file="Main_v1.pdf" pagenumber="7" /><br>

<graphic file="Main_v1.pdf" pagenumber="8" /><br>

<graphic file="Main_v1.pdf" pagenumber="9" /><br>

 

When I compose I get that actual text returned. So it seems like I am missing a command in the rule to tell it is a graphic maybe?

 

 

Anyhow, I have attached what I am trying to do, again just a sample size, my actual job is 477 pages. I am able to do this if I split the original document into single PDF's and then have a data source call in each PDF using a rule. Was hoping there was a way to do this without having to separate my original into 477 single page PDFs. TIA

Main_Final.pdf

Main.pdf

Main_FP.pdf

Flexo_InComm_Final.fpi

Main_Live.txt

Edited by dreimer
Link to comment
Share on other sites

When I compose I get that actual text returned. So it seems like I am missing a command in the rule to tell it is a graphic maybe?

Yes, you need to check "Treat returned strings as tagged text."

Anyhow, I have attached what I am trying to do, again just a sample size, my actual job is 477 pages. I am able to do this if I split the original document into single PDF's and then have a data source call in each PDF using a rule. Was hoping there was a way to do this without having to separate my original into 477 single page PDFs. TIA

You do NOT need to separate anything into multiple single-page PDFs. However, if you were previously using the "Insert Picture Rule" with a graphic frame to output a single page from a PDF resource, and you now want to output multiple pages from the PDF resource, then you do need to rework your job a bit to use inline graphics in a text frame with Overflow pages instead.

 

Again, please take a look at the sample job in this thread:

http://forums.pti.com/showthread.php?t=37

Link to comment
Share on other sites

My apologies but I guess I don't know where to look in the sample job for what I want to do. My particular job is just a single 477 page PDF and all I want to do is impose it.

 

The attachment Main.pdf is supplied (again only a portion of it) and I want to impose to get a result of the attachment Main_Final.pdf and not having to use a data file if possible.

Link to comment
Share on other sites

My apologies but I guess I don't know where to look in the sample job for what I want to do. My particular job is just a single 477 page PDF and all I want to do is impose it.

 

The attachment Main.pdf is supplied (again only a portion of it) and I want to impose to get a result of the attachment Main_Final.pdf and not having to use a data file if possible.

Okay, then maybe what you want to do instead is go to back to having a template with a single page and a single graphic frame, and do something like this in OnRecordStart:

var r = CreateResource("FileName.pdf", "graphic");
FusionPro.Composition.repeatRecordCount = r.countPages;
r.pagenumber = repeatRecordNumber;
FusionPro.Composition.AddGraphicVariable("Insert Picture Rule", r);

Where "Insert Picture Rule" should be the name of the Graphic rule you were previously using to return the graphic. (That Graphic rule can then be deleted.)

 

Or, you can name the graphic frame and change the last line of the rule above to this instead:

FindGraphicFrame("YourFrameName").SetGraphic(r);

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...