Print PDF Byte Array

Printing to a byte array rather than a file requires instantiating an InputPdf instance, where you pass the byte array to the constructor. Then instantiate a new PrintJob instance, where you give the InputPdf instance to the PrintJob instance's constructor. The following example demonstrates printing a PDF byte array.

byte [] pdfBytes = System.IO.File.ReadAllBytes(pdfFilePath);
InputPdf pdf = new InputPdf(pdfBytes);
PrintJob printJob = new PrintJob(Printer.Default, pdf);
printJob.Print();       
Dim pdfBytes As Byte() = System.IO.File.ReadAllBytes(pdfFilePath)
Dim pdf As InputPdf = New InputPdf(pdfBytes)
Dim printJob As PrintJob = New PrintJob(Printer.Default, pdf)
printJob.Print()

In this topic