For the complete documentation index, see llms.txt. This page is also available as Markdown.

Print a PDF to a printer on Server/Desktop

To print a PDF to a default printer, basics.

PDFDoc pdfdoc = new PDFDoc(filename);

// Setup PrinterMode options
PrinterMode 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.DuplexMode.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:
Print.StartPrintJob(pdfdoc, "", pdfdoc.GetFileName(), "", null, printerMode, null);
PDFDoc doc(filename);

// Setup PrinterMode options
PrinterMode 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:
Print::StartPrintJob(doc, UString(""), doc.GetFileName(), UString(""), NULL, &printerMode, NULL );

Print a PDF file - Full Sample Full sample code which illustrates how to print a PDF document using the currently selected default printer. Samples available in Python, C# (.Net), C++, Go, Java, PHP, Ruby, VB. To use this code, you'll need to download and get started with Server SDK.

Last updated

Was this helpful?