Insert blank page to PDF files with Odd Pages

All

I would like to identify the number of pages per PDF file within a folder and where the PDF file has an odd page, I would like to insert a blank page at the end of the PDF document.

I do not want to do this one PDF file at a time and use a javascript or another automated workflow.

Thanks

Enzo


EnzoLisciotto


2 Answers

Portfolios work by placing files within an internal object that can store PDF and other files and then provides a user interface to link to the internal object. This is not a full OS and only supports limited actions needed to add, delete and link to the files. One needs to extract the file to a real storage location, modify the file, and then update the file in the portfolio.


George Kaiser   

You can use an Action - created with the Action Wizard - to do that. To just add a blank page at the end of a document that has an odd number of pages, you can add two processing steps to your Action:

  • Execute JavaScript (under "More Tools")
  • Save (under Save & Export)

Use the following script as your Javascript:

if (this.numPages % 2) {
    this.newPage();
}

This will always add a letter sized page. If you want to use a different page size, see the documentation for the newPage() method: http://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/index.html#t=Acro12_MasterBook%2FJS_API_AcroJS%2FDoc_methods.htm%23TOC_newPagebc-77&rhtocid=_6_1_8_23_1_76

You could get the size of the first page or the last page of the document and then add a blank page of the same size.

Once created, you can run the Action on e.g. all files in a specific directory.

Karl Heinz Kremer
PDF Acrobatics Without a Net
PDF Software Development, Training and More...
http://www.khkonsulting.com


Karl Heinz Kremer   


Please specify a reason: