Jump to content
Mike FandD

Insert a blank page after every page

Recommended Posts

Mike FandD

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?

Share this post


Link to post
Share on other sites
Leslie V.

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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
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.