Skip to main content
Participant
December 6, 2019
Question

Creating Wizard in PDF

  • December 6, 2019
  • 2 replies
  • 370 views

Dear experts

I have thousands of pdf files and I want to save onlt the 2 pages of each file and export the shortened file to excel. 

I use this java script   

   this.extractPages(0.1); 

It cuts by files but creates a .tmp file with the 2 pages. 

I am trying to add the save app from Save and Export, but it does not execute both commands together (the java script and the export). 

What should I do??

Thank you, Giora

  

This topic has been closed for replies.

2 replies

Bernd Alheit
Community Expert
Community Expert
December 6, 2019

Use following code:

if (this.numPages > 2) {
  this.deletePages({nStart: 2, nEnd: this.numPages-1});
  this.dirty = false;
}
try67
Community Expert
Community Expert
December 6, 2019

Are you doing it as a part of an Action?

If so, you can instead delete pages 3-last page, then export the file (this can also be done with a script), then close the original without saving it. The basic code for it would be something like this:

 

this.deletePage(2, this.numPages-1);

this.saveAs(this.path.replace(".pdf", ".xlsx"), "com.adobe.acrobat.xlsx");