Print a PDF to a printer on Server/Desktop

To print a PDF to a default printer, basics.

1doc := NewPDFDoc(filename)
2
3// Set our PrinterMode options
4printerMode := NewPrinterMode()
5printerMode.SetCollation(true)
6printerMode.SetCopyCount(1)
7printerMode.SetDPI(100); // regardless of ordering, an explicit DPI setting overrides the OutputQuality setting
8printerMode.SetDuplexing(PrinterModeE_Duplex_Auto)
9
10// Print the PDF document to the default printer, using "tiger.pdf" as the document
11// name, send the file to the printer not to an output file, print all pages, set the printerMode
12// and a cancel flag to true
13pageSet := NewPageSet(1, doc.GetPageCount())
14boolValue := true
15PrintStartPrintJob(doc, "", doc.GetFileName(), "", pageSet, printerMode, &boolValue)

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.

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales