Some test text!

Search
Hamburger Icon

Php / Guides / Print a document

Print a PDF to a printer in PHP

To print a PDF to a default printer.

$doc = new PDFDoc($filename);

// Setup PrinterMode options
$printerMode = new PrinterMode();
$printerMode->SetCollation(true);
$printerMode->SetCopyCount(1);
$printerMode->SetDPI(600); // regardless of ordering, an explicit DPI setting overrides the OutputQuality setting
$printerMode->SetDuplexing(PrinterMode::e_Duplex_Auto);

// Print the document on the default printer, name the print job the name of the
// file, print to the printer not a file, and use printer options:
PDFPrint::StartPrintJob($doc, "", $doc->GetFileName(), "", null, $printerMode, null);

Print a PDF file
Full sample code which illustrates how to print a PDF document using the currently selected default printer.

Get the answers you need: Chat with us