Jump to content

How to place a 2 page PDF in 1 template page?


Recommended Posts

Hi, I need to display 2 pages of a credit card sized PDF file on an 8.5 x 11 sized template page for proofing purposes. Is there a rule that will bring in a PDF file and insert page 1 and page 2 into separate graphic frames on the same template sheet? I've attached a sample.


Link to comment
Share on other sites

Sure. You just need a separate rule for each graphic frame, each with it's own rule. For the first frame, your rule would look like:

var bg = CreateResource("fileName.pdf");
bg.pagenumber = 1;
return bg;

Rule 2 is a duplicate with pagenumber=2.

Link to comment
Share on other sites

  • 5 months later...

I have a 2 page variable product on the storefront. There is a 2 page pdf uploaded and I want to put page1 of the uploaded pdf to a graphic frame on the products page 1 and put the page 2 of the uploaded pdf on the second page of the product. I can get page one to work but can't get page 2 to work. It just shows up blank. Page 1, I'm just returning the field so it automatically puts page 1 of the pdf in the graphic frame.


I have tried this rule

var bg = CreateResource(Field("pdf")

Link to comment
Share on other sites


My post was cut off a little and didn't notice it. I did try that code and I also tried your code. It works on the desktop but when I load it to Marcom it doesn't show the back. Do you have any javascript globals or anything besides those graphic rules?

Link to comment
Share on other sites

I'm not using any globals or other rules. If this is for a Marcom upload field you will need to use the CreateResource function as Eric mentioned above. I don't think the code I posted would work unless the PDF is already associated. It does seem odd that it's displaying page 1 but not page 2. I would try a few different multiple page PDFs as well to rule out it's not a problem with the source file.


Another method you could try is putting the JavaScript in OnRecordStart instead. You will need to name the frames and remove the other graphic rules.


var r = CreateResource(Field("pdf"), "graphic");

r.pagenumber = 1;

r.pagenumber = 2;

Link to comment
Share on other sites


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

  • Create New...