rsheldon Posted April 15, 2011 Share Posted April 15, 2011 I have a 21 page PDF; the first page is common and the back page(s) are driven by data. How do I tell FP to compose a PDF using in 1 instance page 1 and page 3, 4, 8 and 21 and in the next instance use page 1, 2, 6 and 18. Thanks, Rob Link to comment Share on other sites More sharing options...
Dan Korn Posted April 15, 2011 Share Posted April 15, 2011 Is this an external PDF that you're bringing in as a resource? If so, you can use a modified version of the multi-page PDF insertion rule: http://forums.printable.com/showthread.php?t=37 You can modify the logic to return whatever pages you want with the pagenumber attribute of the <graphic> tag. Or are these pages in your template PDF file? If so, you'll want to name each page in the Page Usage dialog, then you can use the FusionPro.Composition.SetBodyPageUsage() function in OnRecordStart to enable or disable the pages. There are a lot of examples of this on the forum. Link to comment Share on other sites More sharing options...
rsheldon Posted April 15, 2011 Author Share Posted April 15, 2011 Dan, Thank you very much for your response. The PDF Pages are part of my template. I have them named in Page Usage. The issue is, I have never had to set up a multiple page PDF like this. I searched the forum and all I could see was an instance of 3 or 4 pages. Can you point me in the right direction. Normally I would write a variable graphic rule (very long else if statement), I thought I would try a different approach. Thank You, Rob Link to comment Share on other sites More sharing options...
esmith Posted April 15, 2011 Share Posted April 15, 2011 Assuming your 21-page PDF is your base FP template, if you could upload a few sample lines from your data file, we could provide the most applicable code to handle pulling in the correct pages for each record. Link to comment Share on other sites More sharing options...
rsheldon Posted April 15, 2011 Author Share Posted April 15, 2011 Eric, Here is a sample of the data. The cells driving the variable pages are labelled Section01, Section02 thru Section 21. 0 = off, 1 = on Link to comment Share on other sites More sharing options...
esmith Posted April 15, 2011 Share Posted April 15, 2011 In that case, I would go in to the "Manage Pages..." dialog and name all your pages IDENTICALLY to the names of your associated fields in the data file (i.e. Page1="Section01"; Page2="Section02"; etc.) and I would check the box making all pages "unused". Then I would add the following code to my OnRecordStart callback rule: for (var currPage=1; currPage<22; currPage++) { var currField = "Section" + FormatNumber("00", currPage); if (Field(currField) == "1") { FusionPro.Composition.SetBodyPageUsage(currField, true); } } Link to comment Share on other sites More sharing options...
rsheldon Posted April 16, 2011 Author Share Posted April 16, 2011 Eric, Thank you very much for your response, I will try this first thing Monday morning. Is there some publications that you would recommend that might help me understand javescript a little better. Link to comment Share on other sites More sharing options...
esmith Posted April 18, 2011 Share Posted April 18, 2011 I learned by reading the code snippets on these forums, asking questions about code I didn't understand, and googling "javascript" plus whatever I wanted to do. It's not a difficult language to learn -- I'm having a much harder time with Mandarin. =) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.