Jump to content

help with Multipage PDF w/ bleeds


Recommended Posts

I am working on a job and I need to be able to import multipage pdfs into the template as an inline graphic. I have this part of the template working thanks to this forum. The problem I am having with it is the centering of the pdfs. The template needs to accommodate pdfs with and without bleeds. If the customer sends us a pdf with bleeds, the template works fine, but if the pdf has no bleeds than the pdf will be cut off at the top and have extra space at the bottom. I figured out how to completely center the pdf (after reading this forum), but when I do that only the last page of the pdf composes.


Here is the code that I have.

FieldName = '';
PDFfileName = '';
pagesInPDF = 0;
markupToReturn = '';
pathToAllPDFs = 'C:\\Work\\Printable\\Insert PDF Graphics Inline\\Docs\\';
pathToPDF = '';
PDFresourceRef = '';

//This is the main loop that parses through all of the fields for a given record.

   PDFfileName = Field("Doc1");
   pathToPDF = Field("Doc1");

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

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

   //return PDFresourceRef.name;

   //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 + ' "position="center "/>';

       markupToReturn += '<P leading="1">';

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

return markupToReturn;

Link to comment
Share on other sites


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

  • Create New...