Skip to main content
Participant
February 7, 2017
Question

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

  • February 7, 2017
  • 1 reply
  • 539 views

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 );

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
February 7, 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));

try67
Community Expert
Community Expert
February 7, 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);

Participant
February 8, 2017

Thank you so much. This works like a dream.