RyanB Posted November 20, 2008 Share Posted November 20, 2008 I'm specifically looking for the sample which covers importing one PDF with varying page counts into a template. I'm not looking for the sample which imports multiple PDFs into one template. I have a cover letter which now needs each record's PDF appended after it. Thanks in advance, Ryan FP Desktop 5.0P1b Mac OS 10.4.11 Quote Link to comment Share on other sites More sharing options...
Alex Marshall Posted January 16, 2009 Share Posted January 16, 2009 Hello, Are you asking how to import specific pages from a PDF document based on a specified page count in your data file? If so, read on. You don't have to use the multi-page PDF as your input (template) PDF document. Instead, you can use it as an external graphic resource, and specify the desired pages with the FusionProResource.pagenumber property. If you use inline graphics in a text frame with overflow pages, you can insert a variable number of pages for each output record. Here are the steps to take to accomplish this: * Start with a new input PDF document. (You can start from a blank one-page document by saving or printing a blank document to PDF from another application.) The page size should be the same as in the PDF from which you are including the pages. * Define the data source for the document. (You can import from your original input PDF.) * Set a text frame that completely covers the page, starting at X and Y of zero. You may need to extend the width and depth of the page by a bit. * Insert an Overflow page, duplicating the existing Body page. Set the text frame as the overflow destination. (Check the "Overflow To" box on the Text Frame palette.) * Create a Text rule like the one below. Make sure to check the "Treat returned strings as tagged text" box. * Edit the text of the frame on the Body page to include the rule variable. Set the point size of the variable to 1. * Set the Overflow options for the Body page to overflow to your Overflow page (in the "New Left Page" drop list). Leave "New Right Page" as "(None)" and set the add page mode to "As Few Added Pages As Possible." Here is an example of the kind of rule you need: // MODIFY THESE TO MATCH YOUR DATA var PDFResourceFile = "myfile.pdf"; var FirstPageNumber = Int(Field("firstpagenumber")); var FirstPageCount = Int(Field("firstrepeatcount")); var SecondPageNumber = Int(Field("secondpagenumber")); var SecondPageCount = Int(Field("secondpagecount")); var result = ""; var pdf = new FusionProResource(PDFResourceFile, "graphic"); pdf.pagenumber = FirstPageNumber; for (var i = 1; i <= FirstPageCount; i++) result += pdf.content + "\n"; pdf.pagenumber = SecondPageNumber; for (var i = 1; i <= SecondPageCount; i++) result += pdf.content + "\n"; return result; This assumes that you have data fields specifying the page numbers and repeat counts for each. You may have to play around a bit with the size of the frames, but this should work. Quote Link to comment Share on other sites More sharing options...
esmith Posted November 11, 2013 Share Posted November 11, 2013 Well I followed your instructions and received an error message: "Failed to open file </Volumes/BlueEarthShared?vivian/7079 ESCORT CARD/ESCORT CARD list.txt>. what if you renamed the folder and remove the question mark "?" indicated in the path: "BlueEarthShared?vivian" I don't see your confirmation that you renamed your path so that you're not using symbols. I'd go a step further and (temporarily) put your data file and FP template in the same folder/directory and try to link template to data that way. If that works, your initial problem may be network-related rather than FusionPro-related. If that doesn't work, perhaps you could post your template and a stripped down version of your data to see if a user has the same issue on our machine. 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.