Javascript: "copy current file to printer"

The PDF-XChange Viewer for End Users
+++ FREE +++

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

Post Reply
Peter2
User
Posts: 946
Joined: Mon Sep 13, 2010 10:09 am
Location: Switzerland

Javascript: "copy current file to printer"

Post by Peter2 »

We have a HP Plotter with an integrated PDF controller, so we can send files to it. The processsing is done inside the plotter.

We have different tools to upload (to send) the PDF files to the plotter: a web-GUI or small tools (Goplot; Drop&Print) which are based on the standard command:

Code: Select all

"copy test.pdf \\printserver\HPPlotter \b"
It would be fine if this command could be called with javascript from PDFViewer - something like

Code: Select all

"copy this.opened.document to plottername"
Who can help with the (maybe) one-liner JS-code?
PDF-X-Change Pro German
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8436
Joined: Wed Jan 03, 2018 6:52 pm

Re: Javascript: "copy current file to printer"

Post by TrackerSupp-Daniel »

Hi, Peter2

Terribly sorry for the delay in a reply here, the JS used in PDf is Limited in that it can interact with certain content items in the file, and the operations that the application at hand can do. You could, for example, make the Editor save the document to a specified directory, or open the print dialog and use specific settings. Unfortunately, you would likely not be able to tell it to copy or move the current file, especially when we consider that the file is "locked" since it is in use by the Editor/Viewer.

This would be something that you would instead want to run from the windows command prompt, or do manually.

Out of curiosity, may I ask why simply printing from our software to your plotter is not an option? Even if the plotter has its own PDF handler, I do not believe the physical output should not be different between the two methods of sending it, only the "file size" of the print job.

Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Javascript: "copy current file to printer"

Post by Ivan - Tracker Software »

You can try to use doc.print method instead.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
Peter2
User
Posts: 946
Joined: Mon Sep 13, 2010 10:09 am
Location: Switzerland

Re: Javascript: "copy current file to printer"

Post by Peter2 »

TrackerSupp-Daniel wrote: Wed Sep 23, 2020 9:23 pm ...Out of curiosity, may I ask why simply printing from our software to your plotter is not an option? ...
We are talking about large-format prints (drawings with different, non standard sizes), and the idea behind it was that the standard "print from PDF-Software" always contains the part "Page size settings" - define paper format or not, fit or not, position it somewhere and so on. The simple "copy to Plotter and process it there" would make it easier for the user.
But it the meantime we found out that the PDF-processor of the plotter is working really bad, so we cancelled this method :(
Ivan - Tracker Software wrote: Thu Sep 24, 2020 12:41 am You can try to use doc.print method instead.
2. prio, but do you have an example for it? My JS knowledge is raaaaaather low
PDF-X-Change Pro German
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8436
Joined: Wed Jan 03, 2018 6:52 pm

Re: Javascript: "copy current file to printer"

Post by TrackerSupp-Daniel »

Hi, Peter2

I am afraid that I unfortunately do not have any examples handy, but you can find details on the Doc.print method here:
https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/index.html#t=Acro12_MasterBook%2FJS_API_AcroJS%2FDoc_methods.htm%23TOC_print1bc-80&rhtocid=_6_1_8_23_1_79

And general use of JS in PDF here:
https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/index.html#t=Acro12_MasterBook%2FJS_API_AcroJS%2FJavaScript_API.htm

Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Post Reply