Specify a copies to the print with command line

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: Tracker Support, TrackerSupp-Daniel, Sean - Tracker, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Ivan - Tracker Software, Tracker Supp-Stefan

Post Reply
loco jr.
User
Posts: 1
Joined: Sat Mar 30, 2019 1:33 pm

Specify a copies to the print with command line

Post by loco jr. »

Hello.

I'm using PDF-XChange Editor with command line.
How can i do to print
multiple copies with command line.

Current parameters.
/print fileA fileA file A

Ideal parameters.
/print copies=3 fileA

Thanks.
User avatar
Will - Tracker Supp
Site Admin
Posts: 6815
Joined: Mon Oct 15, 2012 9:21 pm
Location: London, UK
Contact:

Re: Specify a copies to the print with command line

Post by Will - Tracker Supp »

Hi loco jr.,

Thanks for the post - I'm afraid that this isn't currently possible, the only way would be to either set this in the UI and print once, then it should be remembered when run from the command line (I realize that's less than ideal), or use the showui="yes" parameter and set it that way.

I'll pass this along as a feature request for consideration.

Thanks,
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.

Best regards

Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
friedrb
User
Posts: 4
Joined: Thu Mar 03, 2022 6:48 pm

Re: Specify a copies to the print with command line

Post by friedrb »

Hi, I'd like to vote for this feature as well!

Thanks,
Bill.
User avatar
Paul - Tracker Supp
Site Admin
Posts: 5864
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: Specify a copies to the print with command line

Post by Paul - Tracker Supp »

HI Bill,

let's do it. ;-)

I have received approval from the development team leader for this so I have raised the associated ticket. While for internal use only, should you refer to RT#6083: Feature request :: Editor :: Command line option to specify the number of copies of a print job here then any support staff member can get yo a status report.

I do not have an ETA for delivery of this feature, ultimately it will be at the Dev Team Leader's discretion.

Enjoy.
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
friedrb
User
Posts: 4
Joined: Thu Mar 03, 2022 6:48 pm

Re: Specify a copies to the print with command line

Post by friedrb »

Thanks!

In the mean time though, I figured out a way to do it.
I'm posting it here in case anyone needs this in the near future.

So, instead of running PDF-XE like this:
(***which of course doesn't work yet, because the "copies" parameter doesn't yet exist):

Code: Select all

PDFXEdit.exe /print:printer="My Printer";copies=5 "myDocument.pdf"
You can do this:

Code: Select all

PDFXEdit.exe /runjs:log=no "myScript.js" "myDocument.pdf"
where "myScript.js" contains this:

Code: Select all

pp = getPrintParams();
pp.interactive = pp.constants.interactionLevel.automatic;  // <-- this causes a silent print
pp.printerName = "My Printer";
pp.NumCopies = 5;
print(pp);
So whenever you need to print multiple copies, you can have your app (or whatever) write a new "myScript.js" file to a temp location with the number of copies you need in it.

As an aside -- I am continually amazed by the PDF-XE team going way above and beyond with the quality of PDF-XE. They've implemented some (or maybe most/all?) of Acrobat's embedded JavaScript abilities into PDF-XE!! You can play with the JavaScript stuff built in to PDF-XE by checking out this document: https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/pdfs/acrobatsdk_jsapiref.pdf

Using that document, I was able to do an even more advanced version of the command line printing above.
This will cause PDF-XE to print multiple copies of a page range (pages 3-5) to show how that can be done via JavaScript.
(Note that pretty much all of the settings in the Print Dialog can be set programmatically with JavaScript.)

The command line way: (***which of course isn't quite ready yet because "copies" isn't yet available)

Code: Select all

PDFXEdit.exe /print:printer="My Printer";pages=3-5;copies=5 "myDocument.pdf"
The JavaScript way: (which you can use right now!)

Code: Select all

PDFXEdit.exe /runjs:log=no "myScript.js" "myDocument.pdf"
where "myScript.js" contains this:

Code: Select all

pp = getPrintParams();
pp.interactive = pp.constants.interactionLevel.automatic;  // <-- this causes a silent print
pp.printerName = "My Printer";
pp.NumCopies = 5;
pp.firstPage = 2; // <-- this is zero based, so page 3 must be "2" here.
pp.lastPage = 4;  // <-- this is zero based, so page 5 must be "4" here.
print(pp);
Enjoy,
Bill.
User avatar
Paul - Tracker Supp
Site Admin
Posts: 5864
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: Specify a copies to the print with command line

Post by Paul - Tracker Supp »

sweet!

Thanks for sharing this Bill.

:D
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Post Reply