Jump to content

INGuser

Registered Users - Approved
  • Posts

    41
  • Joined

Everything posted by INGuser

  1. Hi, I am trying to create one template to use for my mailing. The first 18 pages of my document are the same for every person in my mail list. The remaining pages are variable in length based on a file name in my CSV file. i have 143 different PDF's that could be listed in these three fields so I do not want to create a template with a page for each. I have tried using the follwoing code but can not get my graphis to show up in my output file. //This rule will examine the input data to find a list of PDF files //that are to be inserted in the template. //Each PDF is of varying and unknown page count. Therefore, this script //will determine that page count and reference each page in each PDF. //The resulting tagged markup will include the variable <graphic> tag to reference //the PDF pages and include as inline images in the template. //This text rule in inserted into a large text frame on a Body page. That frame //is set to Overflow to a frame on an overflow page. //First, declare the variables and initiate them with values. FieldName = ''; PDFfileName = ''; pagesInPDF = 0; markupToReturn = ''; pathToAllPDFs = 'C:\Documents and Settings\taypdc\Desktop\West Mailing\PDF'; pathToPDF = ''; PDFresourceRef = ''; //There are 3 fields in this sample - Doc1, Doc2, and Doc3. We will loop through //each field name with a simple for loop. The following variable sets the counter //for that loop. //For example, if you have 25 fields instead of 3 with the PDF file names in them, //such as "Doc1" through "Doc25" you would set the following to 25. FieldsToInspect = 3; //This is the main loop that parses through all of the fields for a given record. for (fieldCounter = 1; fieldCounter <= FieldsToInspect; fieldCounter++) { FieldName = 'PDF File Name_' + fieldCounter; PDFfileName = Field(FieldName); pathToPDF = pathToAllPDFs + PDFfileName; //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="afterline"/>'; markupToReturn += '<P>'; } } //remove the last <P> markupToReturn = Left(markupToReturn, markupToReturn.length - 3); return markupToReturn; I have researched this code ont h forum and tried to do all the things that have been suggested to other users having issues. I am new to using Java Script so i am sure that the issue is me rather than the code. Can someone please help? Test Mailing.zip
×
×
  • Create New...