Documento PDF impreso desde terminal de Windows

Windows – Print PDF from CMD with PDFtoPrinter

In this post I will show you how to print a PDF document from the Windows command line, terminal or CMD using the executable PDFtoPrinter.exe.

As you know, printing a PDF from the Windows terminal is not possible using the print command (since it only prints text files), since a translator is required to read the content of the PDF and send it to the printer.

It is precisely what this utility called PDFtoPrinter.exe does, and in this post I’ll show you how to use it.

Downloading PDFtoPrinter

I can’t upload the executable here, but you can download it from where I downloaded it. Go to the following site: http://www.columbia.edu/~em36/pdftoprinter.html

Then click download it here.

Remember to have that executable in the same directory where you are going to invoke it from the CMD, or if you want to invoke it from anywhere, add it to the PATH.

Basic PDFtoPrinter syntax

The syntax is:

PDFtoPrinter.exe file.pdf printer

You can also indicate number of pages and other options, for this I will leave a link to the documentation.

Print PDF from Windows command line

Note: for this example I’m going to print on a thermal printer but with this utility we can print any PDF document on any printer, even one that is letter size, legal, etc. (only that right now I only have a Thermal one)

For example, I have a ticket in PDF format and the tool:

Documento y PDFtoPrinter

The PDF document is as follows:

ticket

Now from the CMD I navigate to that directory and run the following command:

PDFtoPrinter.exe ticket.pdf POS-58

I am invoking the utility with the name of the document and the name of the printer (my printer is POS-58):

Invocar a PDFtoPrinter para imprimir documento PDF

Note: you can specify the name of the printer in quotes if you want, and also put the name of a network printer, at the end I will leave a link to some documentation.

After a few seconds it will have printed, I say it again, in my case I printed it on a thermal printer but it works for any printer.

The result after printing a PDF document from Windows CMD is as follows:

Documento PDF impreso desde terminal de Windows

As simple as that, you can print all the documents you want and on any printer, preserving all the details.

The advantages of this

With this utility we can print from practically any language on the server side, since we only have to invoke it from the command prompt or CMD, so that we could print in the background and silently from PHP, Python, C #, Go, among others.

Note: if you want to print a ticket to a thermal printer without using PDF see this post.

References

You can find more information about this utility here. I am not related with the page or the utility in any way, I just wanter to share it and show how it is used.


I am available for hiring if you need help! I can help you with your project or homework feel free to contact me.
If you liked the post, show your appreciation by sharing it, or making a donation

Leave a Comment

Your email address will not be published. Required fields are marked *