Jump to content

Getting a Multi-Page PDF Resource to Work


StacyZ

Recommended Posts

Hello,

 

I'm trying to set up a new German envelope and running into difficulty getting the multi-page resource to work correctly.

 

Background info: Deutsche Post (German Post) is requiring that we use the Premium Address barcode on all of the envelopes we send with our direct mail. We have to use their software to produce that barcode, which is unique for every customer. Once we load our data into the DP software and run the file, it produces all of the addresses from our data with their corresponding barcodes on a single PDF file with each record on one page.

 

I downloaded the sample file from this thread on inserting a Multi-page pdf as variable graphic: http://forums.pti.com/showthread.php?t=37

 

I then made some adjustments to match with my data and got the following rule, which isn't working:

FieldName = 'IMP6';

PDFfileName = 'DialogLabels.pdf';

pagesInPDF = 66726;

markupToReturn = Resource('DialogLabels.pdf');

pathToAllPDFs = 'C:\Users\Stacy.Zech\Desktop\PUSH\=Projects\PremAdd_Labels\TestEnvelope(DE-F001)\Links';

pathToPDF = 'C:\Users\Stacy.Zech\Desktop\PUSH\=Projects\PremAdd_Labels\TestEnvelope(DE-F001)\Links';

PDFresourceRef = 'DialogLabels.pdf';

Print(pathToAllPDFs);

FieldsToInspect = 61;

for (fieldCounter = 1; fieldCounter <= FieldsToInspect; fieldCounter++)

{

FieldName = 'SEQNO';

PDFfileName = Field('IMP6');

pathToPDF = pathToAllPDFs + PDFfileName;

PDFresourceRef = CreateResource(pathToPDF ,'DialogLabels.pdf' ,'no');

pagesInPDF = PDFresourceRef.countPages;

for (pageLoop = 1; pageLoop <= pagesInPDF; pageLoop++)

{

markupToReturn += '<graphic file="' + PDFresourceRef.name + '" pagenumber = "' + pageLoop + '" position="afterline"/>';

markupToReturn += '<P>';

}

}

return markupToReturn;

What I am getting when I compose is the first page from the resource PDF showing on the 2nd page, which should be an overflow page.

 

Any help on this would be greatly appreciated.

 

Thank you

Link to comment
Share on other sites

Just in case anyone else has this problem and is looking for answers.

 

It turns out that this simple rule worked instead:

 

var r = new FusionProResource(Field("IMP6"), "graphic", true);

r.name = (Field("IMP6"));

r.pagenumber = CurrentRecordNumber()

if (r.exists) {

return r;

}

else {

return NullResource();

}

Link to comment
Share on other sites

The key bit of info in your original post is that you're composing "a single PDF file with each record on one page." So yes, in that particular case, you need call out each page of the resource for each output record. Though I don't see why you would need an Overflow page at all in such a scenario.

 

The sample code in that other thread is for what is surely the far more common case of outputting multi-page records.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...