LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Print a PDF File

Solved!
Go to solution

Hi,

    I'd like to print a PDF File.
No need to manipulate it, only print.
I found some suggestion about using command line via System Exec VI like this:
"<Path to AcroRd32.exe>" /t "<Path to document>" "Printer name"

But it doesn't seems to work. It opens acrobat reader but it doesn't print.
Any solution can be accepted, even using firefox or chrome or whatever else.
thank you!

0 Kudos
Message 1 of 22
(5,850 Views)

Hi gepp

 

1) have you put cmd /c in the front of the system exec file.
2) does acrobat need to launch from the folder containing the file
(You can navigate to the file using cd "foldername")
you can pass multiple cmd line seperated with & through the System exec funciton.

can you ping the printer (you made need the printername to be case-sensitive).

Opening the report gen toolkit and setting the report type to word report is a method I think I've used in the past - I think it is probably the simplest LV method.
but if you can get a cmdline print working System exec should work.

 

Regards

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 2 of 22
(5,832 Views)

Or just use a pdf printer and print as usual. Windows 10 has a built-in pdf printer.

Certified LabVIEW Architect
Message 3 of 22
(5,816 Views)

@thols wrote:

Or just use a pdf printer and print as usual. Windows 10 has a built-in pdf printer.


Doesn't that create a PDF?

 

Goal as I see it is to print a PDF file.

Message 4 of 22
(5,805 Views)

As long as you use Acrobat Reader (or any reader) you'll be printing by the grace of the reader.

 

Even if it works, Acrobat might decide (as has in the past) to only print after a splash screen, or license acceptance, or acknowledging an update.

 

So if this is going to be deployed, be prepared for bug reports that it doesn't work (anymore or not at all)...

 

As for a solution, I'd look for PDF printing tools that actually where made for the command line. 

 

Gostscript does the job, and doesn't need to be installed (all dependencies can be shipped in a folder). The command line is more complicated, but you won't run into commercial weirdness. 

0 Kudos
Message 5 of 22
(5,803 Views)

@James_W  ha scritto:

Hi gepp

 

1) have you put cmd /c in the front of the system exec file.
2) does acrobat need to launch from the folder containing the file
(You can navigate to the file using cd "foldername")
you can pass multiple cmd line seperated with & through the System exec funciton.

can you ping the printer (you made need the printername to be case-sensitive).

Opening the report gen toolkit and setting the report type to word report is a method I think I've used in the past - I think it is probably the simplest LV method.
but if you can get a cmdline print working System exec should work.

 

Regards

James


1) Yes, but with cmd /c it does nothing, without it it opens acrobat reader
2)Is it a question? No changes even settings the working folder to the folder containing the file.

Yes i can ping the printer.
Unfortunatelly I already have PDF documents, I can't create new report with word.

0 Kudos
Message 6 of 22
(5,801 Views)

@thols  ha scritto:

Or just use a pdf printer and print as usual. Windows 10 has a built-in pdf printer.



???
I already have PDF documents and I need to print them programmatically without user to do nothing.
If I use a pdf printer i will generate a PDF File, not a phisical print.

0 Kudos
Message 7 of 22
(5,800 Views)

wiebe@CARYA  ha scritto:

As long as you use Acrobat Reader (or any reader) you'll be printing by the grace of the reader.

 

Even if it works, Acrobat might decide (as has in the past) to only print after a splash screen, or license acceptance, or acknowledging an update.

 

So if this is going to be deployed, be prepared for bug reports that it doesn't work (anymore or not at all)...

 

As for a solution, I'd look for PDF printing tools that actually where made for the command line. 

 

Gostscript does the job, and doesn't need to be installed (all dependencies can be shipped in a folder). The command line is more complicated, but you won't run into commercial weirdness. 



Thank you,
I'll take a look at it, it sounds a good solution for my needs.

0 Kudos
Message 8 of 22
(5,793 Views)

I'm going to second Ghostcript - it seems I did look at it years ago but never made it work for me (I think it cost money that was not available for my company then).
My 2012 implementation that I eventually got working was ActiveX through a WebBrowser. (I think using AdobeX).
but a lot has changed in activeX support since then so there not even any point in digging out that code.

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 9 of 22
(5,766 Views)

wiebe@CARYA wrote:

@thols wrote:

Or just use a pdf printer and print as usual. Windows 10 has a built-in pdf printer.


Doesn't that create a PDF?

 

Goal as I see it is to print a PDF file.


Not enough coffee here.  (People actually print stuff? To a real physical printer? Yeah I know they do, but it was easier to think otherwise for a tired brain. But, I am interested in if the end-user really wants to print to paper automatically.)

Certified LabVIEW Architect
Message 10 of 22
(5,759 Views)