Some test text!

Loading...
Guides
Print a document

Print a PDF to a printer in Ruby

To print a PDF to a default printer.

doc = PDFDoc.new(filename)

# Setup PrinterMode options
printerMode = PrinterMode.new
printerMode.SetCollation(true)
printerMode.SetCopyCount(1)
printerMode.SetDPI(100)		# 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, "", doc.GetFileName(), "", nil, printerMode, nil)

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: Support

Upcoming Webinar: Live tech update & run-through: Redaction | March 31st at 11 am PT

PDFTron SDK

The Platform

NEW

© 2022 PDFTron Systems Inc. All rights reserved.

Privacy

Terms of Use