This library allows printing files directly from PHP. Avoid print dialog preview in the web browser. Linux and MacOS Compatible. CUPS Required.
If you are using composer, then add neysi/directprint as a dependency:
composer require neysi/directprintIf you have no composer, download the code and include autoload.php
git clone https://github.com/neysi/directprint.git
<?php
require __DIR__ . '/vendor/neysi/directprint/autoload.php');Print on the default printer:
$id = DirectPrint::printFile('invoice.pdf') ;Print on the Canon iP2800 Printer:
$id = DirectPrint::printFile('invoice.pdf','Canon_iP2800_series') ;$printerName = DirectPrint::getDefaultPrinter() ;$printers = DirectPrint::getPrinters() ;Displays print queue
Cancel all of the print queue
Cancel a specific print job