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

I am trying to find a formula that will extract from page 3 up to the last but two pages of a pdf. I then want to save the eo xtracted file and save it to a specific file on the C drive using the original file name with a prefix of INNER. All I have so f

New Here ,
Feb 06, 2017 Feb 06, 2017

I am trying to find a formula that will extract from page 3 up to the last but two pages of a pdf. I then want to save the eo xtracted file and save it to a specific file on the C drive using the original file name with a prefix of INNER.  All I have so far is the formula for extracting the pages -

this.extractPages(2, this.numPages-3 );

TOPICS
Acrobat SDK and JavaScript
484
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 ,
Feb 07, 2017 Feb 07, 2017

This code should do the trick:

var oldDoc = this;

var newDoc = oldDoc.extractPages(2, oldDoc.numPages-3 );

newDoc.saveAs(oldDoc.path.replace(oldDoc.documentFileName, "INNER " + oldDoc.documentFileName));

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 ,
Feb 07, 2017 Feb 07, 2017

Sorry, I've noticed you want to save it to a pre-defined folder. The code above will save the new file to the same folder as the original.

Let's say you want to save it to C:\Temp\. Use this code to do that:

var oldDoc = this;

var newDoc = oldDoc.extractPages(2, oldDoc.numPages-3 );

newDoc.saveAs("/c/temp/INNER " + oldDoc.documentFileName);

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
New Here ,
Feb 07, 2017 Feb 07, 2017
LATEST

Thank you so much. This works like a dream.

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