I need to print a PDF file and i have two choices:
- printing from nodejs app
- executing from command line.
From node i have tried "printer", "node-native-printer, "node-printer" libraries but when i try to print my PDF i get a lot of pages with the file's source code printed in every page. From command line i tried lp/lpr and and also in this case I get the same result, lot of pages with source code (as if i were opening the PDF with a text editor and print what you can see there). I also tried to make a .txt file like this:
AAAAAAAAAAAA
qwerty
zxcvbnm
but lp/lpr prints only the first line of AAAAAAAAAAAA
I have also tried in windows, from command line (PDFtoPrinter command) prints the PDF correctly.
Actual printer in use: " Xerox WorkCentre 3225", with drivers installed both on windows and linux.
EDIT 1
My .pdf file is not just a text file, it contains text, barcodes etc. so i can't convert to txt.
EDIT 2
I found a solution:
- pdf2ps filename.pdf filename.ps
- lpr filename.ps
This works, but i would like to know if there is a solution to print it directly.