Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
11

Insert pages from file using a script

New Here ,
Oct 11, 2023 Oct 11, 2023

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

TOPICS
Create PDFs , Edit and convert PDFs , How to , JavaScript , PDF
562
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 11, 2023 Oct 11, 2023
LATEST

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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines