Jump to content

Cover Page Folowed by a PDF File


draco66

Recommended Posts

Good morning,

 

I would be gratefull for some assistance in building a template for an ongoing job.

 

The output for each record in the database consists of the following:

 

1) A cover page (2 pages actually) which is page one and two in my template and has variable fields that pull from the database.

 

2) A PDF file follows the cover page. This PDF file is stored in a folder on the local C: drive. The name of the file is different for each record and the file name is included in the database. Each PDF has a different page count.

 

So I need FusionPro to create the cover pages and then grab the correct PDF from the folder and add it in after those two cover pages. then move on to the next record and do the same thing.

 

It would also be great if the output could be a seperate file for each record in the database. The seperate file is not as important but it would save a lot of time later in our process.

 

Thank you for any help you can provide.

 

Bob M.

Link to comment
Share on other sites

I did a very similar job a while back and here is what I have.

 

Our chart column was formatted C1C4. So it was set to split on the "C."

 

You will need to insert a 2 blank pages at the end of your document and draw a text frame the size of the the blank pages. Set page 2 of the blank pages to be and overflow page.

 

This may not make very much sense as it is not easy to explain, but hopefully a good starting point.

 

 

Here is the script that we used.

 

pathToAllPDFs = "PATH_TO_YOUR_FOLDER";
pagesInPDF = 0;
markupToReturn = '';
pathToPDF = '';
PDFresourceRef = '';

// Split used charts field into array
var usedcharts_array = Field("YOURPDFCOLUMNHERE").split("C");

//This is the main loop that parses through all of the fields for a given record.
for (x = 1; x < usedcharts_array.length; x++) 
   {

   pathToPDF = pathToAllPDFs + "C" + usedcharts_array[x] + ".pdf";

   // Create a new resource that references this
   PDFresourceRef = CreateResource(pathToPDF ,'graphic' ,'no');

   // Find out how many pages it has
   pagesInPDF = PDFresourceRef.countPages;

   // This is the secondary loop for this script.
   // It will loop through and create markup for each page in the PDF.
   for (pageLoop = 1; pageLoop <= pagesInPDF; pageLoop++)
       {
       markupToReturn += '<graphic file="' + PDFresourceRef.name + '" pagenumber = "' + pageLoop + '" height="79200" position="afterline"/>';
       markupToReturn += '<P>';
       }
   }

// remove the last <P>
markupToReturn = Left(markupToReturn, markupToReturn.length - 3);

return markupToReturn;

Link to comment
Share on other sites

Thank you for your input on this. I did get it to work however the PDF's supplied by the customer were created with some sort of PDF compiler and when I run it through Fusion Pro a bunch of the pages come out blank. I am looking at others ways to accomplish this task.

 

Thank you again for your input.

 

Bob M.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...