neysi / directprint
Easy and direct file print from PHP
Installs: 7 888
Dependents: 0
Suggesters: 0
Security: 0
Stars: 19
Watchers: 3
Forks: 10
Open Issues: 1
pkg:composer/neysi/directprint
Requires
- php: >=5.3.0
Requires (Dev)
- phpunit/phpunit: 4.0.*
This package is not auto-updated.
Last update: 2025-10-26 00:19:38 UTC
README
This library allows printing files directly from PHP. Avoid print dialog preview in the web browser. Linux and MacOS Compatible. CUPS Required.
Installation
Include the library
Composer
If you are using composer, then add neysi/directprint as a dependency:
composer require neysi/directprint
Manual
If 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');
Methods
printFile($fileName,$printerName)
Print on the default printer:
$id = DirectPrint::printFile('invoice.pdf') ;
Print on the Canon iP2800 Printer:
$id = DirectPrint::printFile('invoice.pdf','Canon_iP2800_series') ;
getDefaultPrinter()
$printerName = DirectPrint::getDefaultPrinter() ;
getPrinters()
$printers = DirectPrint::getPrinters() ;
activeJobs()
Displays print queue
cancelAllJobs()
Cancel all of the print queue
cancelJob($jobID)
Cancel a specific print job