Copy link to clipboard
Copied
Hello,
i am using
var fileNameOne = trk + "-" + Ono + "-" prk + ".pdf";
var fileNameTwo = drs + "-" + Ono + "-" prk + ".pdf";
var fileNameThree = rrs + "-" + Ono + "-" prk + ".pdf";
if(4==app.alert("Following Documents will get created: \n\n" + fileNameOne + "\n" + fileNameTwo + "\n" + fileNameThree + "\n\nContinue?",2,2)) {
doReadonly();
this.extractPages(0,1,fileNameOne);
this.extractPages(2,4,fileNameTwo);
this.extractPages(8,11,fileNameThree);
app.alert("The Documents was saved",3,0,"Success");
undoReadonly();
}
else {
app.alert("Documents not able to save!",0,0,"Error");
}
Additional i added the folder and the file itself at Settings > Security (advanced) to the trusted sources.
I works very well with my acrobat Pro DC, but when running it with the Acrobat Free version i get the Error
RangeError: Invalid argument value.
Doc.extractPages:42:Field save:Mouse Up
Is there a functionality in this code which requires a feature of the pro version?
Thank you very much in advance.
What does you mean with "Acrobat Free" ?
Acrobat Reader can't extract pages.
Copy link to clipboard
Copied
The extractPages function executes in a privileged context, specifically when doing batch actions.
I am not very savvy with Acrobat JavaScript yet as to explain how to elevate the privilege context of this action through a function that can be implemented in a document that will be used with Adobe Reader.
Maybe, you'll need to save the script as a function in that document, and work around on how to call that function properly with the mouse-up event action.
In addition , it may be necessary to also save that PDF with Reader enabled rights... but I may be wrong if this necessary or not.
In any case, see this article posted by ACP Thom Parker:
https://acrobatusers.com/tutorials/extracting-pages-pdf-acrobat-javascript/
Copy link to clipboard
Copied
The error message means that you extract pages which doesn't exists. How many pages has the document?
Copy link to clipboard
Copied
Thank you for clarifying Bernd.
Copy link to clipboard
Copied
Hey Bernd,
the Document has 16 pages.
The curious thing is, that i tried the exact same document with the function and it works on Pro but not on Free.
Copy link to clipboard
Copied
What does you mean with "Acrobat Free" ?
Acrobat Reader can't extract pages.
Copy link to clipboard
Copied
Ok, i feared that. I created the PDF with Acrobat DC but wanted to offer the File also to users with just Adobe Acrobat Reader.
Copy link to clipboard
Copied
And, for sure, the free Reader cannot extract pages in the UI, it doesn't have this function to automate. You don't have to guess, this info is shown for every method in the API reference, in the Quick Bar.
Copy link to clipboard
Copied
Im not trying to use the UI, so do i understand right, that to use this function in Javascript the function the user needs pro?
Copy link to clipboard
Copied
Did you look in the documentation as I suggested? Yes, the user needs Pro or Standard for this function, and many others. These features are marketing tools for Acrobat.