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

How can I make a single new .PDF out of many .PDF's 1st pages with javascript?

New Here ,
Jan 20, 2020 Jan 20, 2020

Copy link to clipboard

Copied

Good Forum Folk,

 

  I wish to create a new .PDF composed of all the first pages of a large number of other .PDF's.  My preferred approach would be to create an Action with the "Default option:" of "Add folder..." as its first step.  At present I have the following javascript as my second step:

 

this.print(false,0,0,true);  [which sends p. 1 of the selected .PDF as a print job to the last-used printer]
this.closeDoc(true);        [which closes the selected document]

 

I would like to improve the script so that it only prompts to begin the process once (instead of for each .PDF included in the batch).

 

I look forward to your suggestions.

 

QD

TOPICS
Acrobat SDK and JavaScript

Views

49

Likes

Translate

Translate

Report

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 ,
Jan 20, 2020 Jan 20, 2020

Copy link to clipboard

Copied

You can use the extractPages command to export the first pages to a single folder, and then manually combine all the files in that folder.

You do not need to add a closeDoc command to an Action. It does that automatically.

Likes

Translate

Translate

Report

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 ,
Jan 20, 2020 Jan 20, 2020

Copy link to clipboard

Copied

LATEST

One strategy is to create a PDF from first page of the first document processed, using the "doc.extractPages" function. Do not close this doc or extract it with a path. Instead, place the document object returned from extract pages into a global variable. Then for every document after that insert a page into the document. 

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

Likes

Translate

Translate

Report

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