Fabian Posted November 17, 2011 Share Posted November 17, 2011 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.Sample.pdf Link to comment Share on other sites More sharing options...
esmith Posted November 17, 2011 Share Posted November 17, 2011 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.countpages; bg.pagenumber = 1; return bg; Rule 2 is a duplicate with pagenumber=2. Link to comment Share on other sites More sharing options...
Fabian Posted November 17, 2011 Author Share Posted November 17, 2011 Thank you Eric! Link to comment Share on other sites More sharing options...
jwhittaker Posted May 1, 2012 Share Posted May 1, 2012 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 More sharing options...
ThomasLewis Posted May 1, 2012 Share Posted May 1, 2012 The easiest way to do it is to create a rule like this for each page: var pdffile = Resource(Field("pdf")); pdffile.pagenumber = 1; return pdffile; Then assign the rule to the graphic frame. Link to comment Share on other sites More sharing options...
jwhittaker Posted May 1, 2012 Share Posted May 1, 2012 Thomas 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 More sharing options...
ThomasLewis Posted May 1, 2012 Share Posted May 1, 2012 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; FindGraphicFrame("frame1").SetGraphic(r); r.pagenumber = 2; FindGraphicFrame("frame2").SetGraphic(r); Link to comment Share on other sites More sharing options...
jwhittaker Posted May 1, 2012 Share Posted May 1, 2012 Thomas Thanks for the other option. I tried it and it's now putting page 1 of the uploaded pdf in both pages. I did a collect and have a pdf I'm using for testing in the zip file. If you can see anything let me know otherwise I'll have to wait for Dan the Man. I do really appreciate your time helping me. JongiftcardVAR_collect.zip Link to comment Share on other sites More sharing options...
ThomasLewis Posted May 1, 2012 Share Posted May 1, 2012 I modified the JavaScript in my post above. Tested it in Marcom and it is working for me. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.