Go Back   PTI Marketing Technologies User Community > Software-Related Talk > FusionPro® VDP Creator

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 3rd, 2018, 11:39 AM
Fellsway Fellsway is offline
Junior Community Member
 
Join Date: Apr 2012
Location: Dallas
Posts: 33
Default Multiple Page PDF

Can someone help with this.... I have a 16 page document where I need to insert numerous Multipage PDFs. Most of PDFs are 16 pages but some are only 15 pages. If they are only 15 pages I need to insert an alternative single page PDF as the 16th page. I am using the rule below for each page but not sure how to have it add my alternate PDF if the Multipage PDF is only 15 pages.

var r = Rule("Insert Picture Rule");
r.pagenumber = 16; // or 1 here
return r;

Sorry if this explanation was clear as mud.
Reply With Quote
  #2  
Old December 5th, 2018, 12:52 PM
Fellsway Fellsway is offline
Junior Community Member
 
Join Date: Apr 2012
Location: Dallas
Posts: 33
Default Re: Multiple Page PDF

I probably have everyone scratching their heads with my first post so how about this... If the PDF image I'm pulling in is 15 pages instead of 16, how can i have a alternate page 16 turn on in page usage?


pagesInPDF = 0;
markupToReturn = '';
PDFresourceRef = new FusionProResource(Field("PDF"), "graphic", true);

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

//Page usage loop to turn pages on based on pagesInPDF
for (i = 1; i <= pagesInPDF; i++){
FusionPro.Composition.SetBodyPageUsage('p' + i, true);
}

//Graphic frame loop to specify which pdf page goes into which graphic frame
for (pageLoop = 1; pageLoop <= pagesInPDF; pageLoop++){
var frame = FindGraphicFrame('p' + pageLoop);
frame.SetGraphic('<graphic file="' + PDFresourceRef.name + '" pagenumber = "' + pageLoop + '" scale="off" />');
}
return markupToReturn;
Reply With Quote
  #3  
Old December 7th, 2018, 05:20 PM
ThomasLewis's Avatar
ThomasLewis ThomasLewis is offline
Senior Contributor
 
Join Date: Feb 2011
Posts: 203
Default Re: Multiple Page PDF

Here's how I would do it:

Code:
pagesInPDF = 0;
markupToReturn = '';
PDFresourceRef = CreateResource(Field("PDF"), "graphic", true);

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

//Page usage loop to turn pages on based on pagesInPDF
for (i = 1; i <= pagesInPDF; i++)
	FusionPro.Composition.SetBodyPageUsage('p' + i, true);	

if (pagesInPDF < 16)
	FusionPro.Composition.SetBodyPageUsage('alternate', true);	

//Graphic frame loop to specify which pdf page goes into which graphic frame
for (pageLoop = 1; pageLoop <= pagesInPDF; pageLoop++)
{
	var frame = FindGraphicFrame('p' + pageLoop);
	PDFresourceRef.pagenumber = pageLoop;
	frame.SetGraphic(PDFresourceRef);
}

return markupToReturn;
I don't know what you are returning there though, seems blank, but I left it in for whatever reason.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:00 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.