Skip to main content

Simple Print

Version: 1.0

Simple Print

The below simple example demonstrates how to send a PDF document to a specified printer. Replace the string "Printer Name" with the actual name of the printer you wish to send the PDF document to.

PrintJob printJob = new PrintJob("Printer Name", "C:\\Temp\\DocumentA.pdf");
printJob.Print();
Dim MyPrintJob As New PrintJob("Printer Name", "C:\Temp\DocumentA.pdf")
MyPrintJob.Print()

Sending the PDF document to the defined default printer without needing to know the actual name of the printer can be done using the static method "Default" off the Printer class. This is demonstrated in the example code below.

PrintJob printJob = new PrintJob(Printer.Default, "C:\\Temp\\DocumentA.pdf");
printJob.Print();
Dim MyPrintJob As New PrintJob(Printer.Default, "C:\Temp\DocumentA.pdf")
MyPrintJob.Print()