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

New Here ,
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, Edit and convert PDFs, How to, Print and prepress

Views

30

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

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

New Here ,
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, Edit and convert PDFs, How to, Print and prepress

Views

31

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
Jan 20, 2020 0
Most Valuable Participant ,
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
Reply
Loading...
Jan 20, 2020 0
Adobe Community Professional ,
Jan 20, 2020

Copy link to clipboard

Copied

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. 

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
Reply
Loading...
Jan 20, 2020 0