I have been searching all over the internet for full information on this, and I'm just having a very difficult time figuring it out and would appreciate any help I can get.
I have a function which is intended to automatically split PDFs based on the text of the page. According to the console, everything works fine in this function except for the "extractPages" function, which returns the following error:
RangeError: Invalid argument value.
As I looked into it, it appears that this function is a privileged function, and this is where I start getting confused. As far as I know, there is some folder-level script that needs to be added in a certain folder (which I believe I've found) which gives the program privileges to do this sort of thing. However, past that, I'm totally lost. Does the splitPages function itself go into that .js file in the folder level? How do I call it? How do I set the correct permissions?
If anyone can help me out, or direct me to a well-explained set of instructions, I would greatly appreciate it. Everything I've found so far talks generally about these things, but I can't find any specifics.
I had found the top and bottom links already, but the middle one was actually the one that helped me the most.
Specifically this part:
trustedNewDoc = app.trustedFunction( function (nWidth, nHeight)
// Additional code may appear above
app.beginPriv(); // Explicitly raise privilege
app.newDoc( nWidth, nHeight );
// Additional code may appear below.
After Acrobat is restarted, the trustedNewDoc function can be executed from anywhere. The following script for a mouse-up action of a button creates a new document that is 200 points by 200 points.
trustedNewDoc( 200, 200 );
Thank you so much for the reference! It worked perfectly.
I strongly recommend you give your trusted function a name chosen by you and unguessable. The tendency to call all trusted function with obvious names undermines all the security and could lead to the whole thing being closed down as a weakness.
Can you elaborate on that? Isn’t the name of the function called in the PDF document anyway? Couldn’t anyone access the name of it that way? And is this as much of a risk if I am just using it on my personal computer?