1
I wonder if there is a way to print a PDF document directly (without the need to press Ctrl+p in the browser) via PHP or Javascript. For example: create a button that, when clicked, sends the PDF document to the user’s print queue. I’m a beginner in these two languages, so I don’t know if it’s a simple solution question.
I found this, I don’t know if it helps: https://stackoverflow.com/questions/19124808/printing-pdfs-from-windows-command-line?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
– Marcelo Shiniti Uchimura
Just use the event
window.print()
, for example<button type="button" onclick="window.print()">Imprimir</button>
. To choose which elements to print, you can use a specific CSS for printing.– Valdeir Psr
You can, for example, in PHP, call Pdftoprinter as follows:
system('PDFToPrinter.exe ' . $pdfpath, $result);
, Pdftoprinter is on the link above and more easily on this one: http://www.columbia.edu/~em36/pdftoprinter.html– Marcelo Shiniti Uchimura
Gave it right @Marcelouchimura, thank you very much!!
– Renan Lopes