I am trying to manipulate (collect individual pages from different sources) different pdf files automatically, in future through windows task planning, hence using windows command line.
PDFXEdit.exe "D:\xxx\Test01.pdf" /runjs "D:\xxx\Code7.js" works, opening the correct File and starting the Script (that is working properly in the console).
The quite boring script looks as follows: (You can see my desperate try to get access to "this")
var export_report = app.trustedFunction ( function(t) {
var myPath = "/d/xxx/Testresult7.pdf"
app.beginPriv();
t.replacePages(0,"/d/xxx/Fancyfile.pdf",4)
t.insertPages(0,"/d/xxx/Fancyfile.pdf",14)
t.insertPages(1,"/d/xxx/Fancyfile.pdf",11)
t.saveAs(myPath);
app.endPriv();
});
export_report(this);
 
However, although I marked both Test01.pdf and Code7.js as trustworthy in the setting, I constantly get:
External:Exec:1: NotAllowedError: NotAllowedError: Security settings prevent access to this property or method.
App.trustedFunction:1:External:Exec
Could you please tell me how I can prevent that error?
Thanks a lot in advance!
			
			
									
																
						Manipulate pdfs from windows shell
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange
- 
				HIghly-Energetic
 - User
 - Posts: 1
 - Joined: Fri Sep 19, 2025 11:55 am
 
- 
				Daniel - PDF-XChange
														 - Site Admin
 - Posts: 11888
 - Joined: Wed Jan 03, 2018 6:52 pm
 
Re: Manipulate pdfs from windows shell
Hello, HIghly-Energetic
Thank you for the report. I should first note that the Editor is not intended to work as a form of "batch processing" application, which this use seems to fall into. I have reached out to confirm if this use intent is allowed with an end user Editor license, or if this is something you would need to handler either Via PDF-tools, or through an SDK product instead.
As for the "NotAllowed" issues you are encountering, This has been forwarded to the Dev team for review, and I will let you know as soon as I have heard back from them.
Kind regards,
			
			
									
													Thank you for the report. I should first note that the Editor is not intended to work as a form of "batch processing" application, which this use seems to fall into. I have reached out to confirm if this use intent is allowed with an end user Editor license, or if this is something you would need to handler either Via PDF-tools, or through an SDK product instead.
As for the "NotAllowed" issues you are encountering, This has been forwarded to the Dev team for review, and I will let you know as soon as I have heard back from them.
Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
			
						PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
- 
				Roman - Tracker Supp
														 - Site Admin
 - Posts: 337
 - Joined: Sun Nov 21, 2004 3:19 pm
 
Re: Manipulate pdfs from windows shell
Hello, HIghly-Energetic. 
We have changed the execution context of command line scripts to Batch, so that privileged functions like app.newDoc or doc.saveAs should work in your case. The change will be available in the upcoming minor release of the Editor.
In the meanwhile you can add a trusted function to the Editor initialization scripts and execute it from your command line script.
By the way, you can reference the current document as. This is an undocumented property but supported both in the Editor and Adobe Acrobat.
			
			
									
																
						We have changed the execution context of command line scripts to Batch, so that privileged functions like app.newDoc or doc.saveAs should work in your case. The change will be available in the upcoming minor release of the Editor.
In the meanwhile you can add a trusted function to the Editor initialization scripts and execute it from your command line script.
By the way, you can reference the current document as
Code: Select all
app.doc- 
				Vasyl - PDF-XChange
														 - Site Admin
 - Posts: 2460
 - Joined: Thu Jun 30, 2005 4:11 pm
 
Re: Manipulate pdfs from windows shell
Another possibility to do it - via our PDF-Tools. 
Here is an example Tool attached:
HTH
			
			
						Here is an example Tool attached:
HTH
You do not have the required permissions to view the files attached to this post.
			
													PDF-XChange Co. LTD (Project Developer)
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
			
						Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.