Jump to content

Insert a blank page after every page


Mike FandD

Recommended Posts

I need to insert a blank page after every page in the file.  I am aware of the insert page function but that would require me to repeat that task 400-1200 a week.  I have tried using the script below in File - Batch Processing - Execute Java Script - Continue - Add Files - Run.   

(function () {
var curDoc = app.activeDocument,
  allPages = curDoc.pages,
  nPages = allPages.length,
  curPage,
  i,p;

for (i = nPages-1; i >= 0; i--) {
  curPage = allPages;
  p = curDoc.pages.add();
  p.move(LocationOptions.AFTER, curPage);
}
}) ();

The dialog box after reads

File 1: Processing C:\Users\Mailing\AppData\Local\Temp\NitroBatchFolder\RenewalNoticePDF_06-21-2019_AT_08_32_AM.pdf.pdf
    Running Execute JavaScript action
End of Processing
Total files count: 1
Completed successfully: 0
Failed: 0

When I open my file, no changes have been made.  Is there a way to insert a blank page after every page of a pdf within Nitro 12?

Link to comment
Share on other sites

  • Official Nitronaut

Hello @Mike FandD,

Thanks for posting here!

Nitro supports the use of Javascript however our Customer support team won't be able to give advice on Java codes because we are not Java-trained.

Hopefully, one of our users who might be knowledgable in Javascript will be able to help.

Cheers!

Link to comment
Share on other sites

  • 2 weeks later...
  • Power User
Steven Zakulec

There should be a way to do what you're trying to do, but when running that script in a single PDF, it errors out immediately here: var curDoc = app.activeDocument,

Nitro complains that curDoc is undefined.  I'm not really a Javascript person, but as far as I can tell, Nitro's not recognizing app.activeDocument (or something else weird is happening).

Here's the list of supported functions: https://www.gonitro.com/user-guide/pro/javascript-objects

Possibly you could build something using the objects from this?

Do let me know if you manage to find something that works here- I'd be thrilled.

Wish I could be more help here.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.