Copy link to clipboard
Copied
We have an Action that extracts the first page in multiple PDFs:
this.extractPage(6,7);
Where 0 = the first page, what can we use to = equal the last page for
multiple pdfs that vary in the number of pages that each have?
Thanks.
You needed to only replace 0, like this:
this.extractPages(this.numPages-1);
And it's extractPages, not extractPage...
Copy link to clipboard
Copied
You can use: this.numPages-1
Copy link to clipboard
Copied
Actually the first statement in my original post should have read:
this.extractPage(0);
This extracts first page of multiple pdfs
Whether putting -1 or writing the statement as:
this.extractNumPages-1;
Neither one appears to work.
Also, we have a more robust script that works for extracting the first page of multiple pdfs:
/ScriptCode [/t (this.extractPages\({nStart:0, cPath: this.path.replace\("/.*\\/|\\.pdf$/ig", ""\)+"_P1"+".pdf"}\);\r\n)]
How could this be changed to extract the last page of multiple varying length pdfs?
Copy link to clipboard
Copied
You needed to only replace 0, like this:
this.extractPages(this.numPages-1);
And it's extractPages, not extractPage...
Copy link to clipboard
Copied
That got it to work... thanks!!!
Copy link to clipboard
Copied
Hello,
Give this a go......
/* Extract Last Page */
var re = /.*\/|\.pdf$/ig;
var filename = this.path.replace(re,"");
{
for ( var i = 0; i < this.numPages; i++ )
if (i == this.numPages-1) {
this.extractPages ({ nStart: i, nEnd: i, cPath : filename + "_" + (i+1) + ".pdf"});
}
};
Regards,
Mike
Copy link to clipboard
Copied
We tried this one out... for some reason it returned an error that said it was invalid
Copy link to clipboard
Copied
This script extracts all pages of a document.