dhealy72 Posted November 19, 2014 Share Posted November 19, 2014 I am wondering if it's possible to insert a PDF graphic with multiples pages and have the file compose with the multiple pages, or if it is only possible to compose the first page of that inserted graphic? Quote Link to comment Share on other sites More sharing options...
ScottHillock Posted November 20, 2014 Share Posted November 20, 2014 Yes you can do that. Here is the javascript I use for it: var Var1 = "Filename.pdf"; //PDF filename var Var2 = "1"; //Page Number to import var bg = CreateResource(Var1); bg.countpage; bg.pagenumber = Var2; return bg; Quote Link to comment Share on other sites More sharing options...
dhealy72 Posted November 20, 2014 Author Share Posted November 20, 2014 Thanks! I'll give it a try. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted November 20, 2014 Share Posted November 20, 2014 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 Quote Link to comment Share on other sites More sharing options...
dreimer Posted November 20, 2014 Share Posted November 20, 2014 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 Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted November 20, 2014 Share Posted November 20, 2014 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. Quote Link to comment Share on other sites More sharing options...
dreimer Posted November 20, 2014 Share Posted November 20, 2014 (edited) 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. TIAMain_Final.pdfMain.pdfMain_FP.pdfFlexo_InComm_Final.fpiMain_Live.txt Edited November 20, 2014 by dreimer Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted November 20, 2014 Share Posted November 20, 2014 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 Quote Link to comment Share on other sites More sharing options...
dreimer Posted November 20, 2014 Share Posted November 20, 2014 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. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted November 20, 2014 Share Posted November 20, 2014 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); Quote Link to comment Share on other sites More sharing options...
dreimer Posted November 20, 2014 Share Posted November 20, 2014 I get an error in line 3. ReferenceError: repeatRecordNumber is not defined. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted November 20, 2014 Share Posted November 20, 2014 I get an error in line 3. ReferenceError: repeatRecordNumber is not defined. Sorry, that should be: r.pagenumber = FusionPro.Composition.repeatRecordNumber; Quote Link to comment Share on other sites More sharing options...
dreimer Posted November 21, 2014 Share Posted November 21, 2014 That works perfectly!!! Thank you very much will use this often! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.