Jump to content

Add Blank Page After Each Page


Recommended Posts

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;

Link to comment
Share on other sites

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 between

You 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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...