kelly.anderson Posted October 23, 2013 Share Posted October 23, 2013 I'm working on an application book that will be pulling in pdfs from a library based on the state. The number of pages in these pdfs vary from state to state. We have hundreds of these pdfs already created, but now we need each of them to be 1-sided (a blank page after every page). Rather than changing all the library PDFs to include blank pages, I'd really like to just add an empty page when composing the document instead. Currently I have my document set up with a Body page and a text box which links to an Overflow page's text box. This works correctly, but I don't know how to add in the blank page after every page. I think I'm close. Here is my text javascript rule so far: var Application = ""; var result = ""; if (Field("State") == "New York") { Application = "AppA.pdf" } else { Application = "AppB.pdf" } PDFArray = [Application] for (i = 0 ; i < PDFArray.length ; i++) { if (PDFArray != "") { myPDF = PDFArray; var Pic = new FusionProResource(myPDF, "graphic", "true"); for (Pic.pagenumber = 1; Pic.pagenumber <= Pic.countPages; Pic.pagenumber++) { if (Pic.pagenumber == Pic.countPages) { result += Pic.content+; } else { result += Pic.content+"<p>"; } } } } return result; Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted October 24, 2013 Share Posted October 24, 2013 You should be able to simply add some more <p> tags in between each <graphic> tag (inline graphic). The empty paragraphs won't have anywhere to go but on a new page, and the next inline graphic (next page in the PDF) will also have to go to a new page. I think you can accomplish this by just changing the line near the end of your rule like so: result += Pic.content+"<p><p><p>"; // extra space to bring in a blank page in betweenYou may need to experiment a bit to figure out exactly how many <p> tags you need, but this should work. The entire rule could be written a lot more concisely as well: var myPDF = (Field("State") == "New York") ? "AppA.pdf" : "AppB.pdf"; var Pic = new FusionProResource(myPDF, "graphic", true); var PDFArray = []; for (Pic.pagenumber = 1; Pic.pagenumber <= Pic.countPages; Pic.pagenumber++) PDFArray.push(Pic.content); return PDFArray.join("\n<p><p><p>\n"); // extra space to bring in a blank page in between Quote Link to comment Share on other sites More sharing options...
kelly.anderson Posted October 24, 2013 Author Share Posted October 24, 2013 That works well, thanks for the help! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.