Skip to main content
Participant
October 11, 2023
Question

Insert pages from file using a script

  • October 11, 2023
  • 1 reply
  • 738 views

Hello,

I'm new with scripting in Acrobat, but I'm locking for the way to:

Insert pages from file using a script.

The scenario is:

having a file: xxxx_PR_V01.pdf, I need to insert at the end of the last page in this file another file in the same folder xxxx_TS_V01.pdf.

The xxxx is the name of the folder so.

What do I need to automate this by script?

Thanks

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
October 11, 2023

Use the "doc.insertPages()" function.  Unfortunately the Acrobat JavaScript reference was recently screwed up, so there's no direct link. This will get you close.

https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/doc.html#doc-methods 

 

Here's an example, it assumes that "PR_V01.pdf" is open and the current document:

 

this.insertPages(this.numPages-1,"TS_V01.pdf");

 

This code can be run from the console window or an automation script:

https://www.pdfscripting.com/public/Automating-Acrobat.cfm

 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often