Hey everyone!
This is an awesome thread and has really helped me with my project. Below is the tactic I ended up using:
-Create a 48pg document to receive in any pdf with up to 48pages
-Name each page as 'p1', 'p2, 'p3', etc...
-Make them all unused pages except for pg1
-Create a graphic frame on each page and name the frames 'p1', 'p2, 'p3', etc...
-The OnRecordStart will do the rest
Take a look at the zip attachment, all code and a working template are included inside it.
Here is the code for those who want a quick preview:
pagesInPDF = 0;
markupToReturn = '';
PDFresourceRef = new FusionProResource(Field("image"), "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;
*****One catch with this template, you can't impose multiple records where the pdf page count varies. For example, record 1 has a 16p PDF and record 2 has a 32p PDF. The template will only use the record 1 (16p) info. I believe this due in part to the template using FPImposer.
Cheers,
Mark FP_Forum.zip