Skip to main content

Print PDF Byte Array

Version: 4.0

Print from PDF Byte Array

Printing from a byte array instead of a file requires creating an InputPdf instance and passing the PDF byte array to its constructor. After creating the InputPdf object, instantiate a new PrintJob and pass the InputPdf instance to the PrintJob constructor. The following example demonstrates printing a PDF document from a 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()

[ByteArrayExample.cs](https://github.com/DynamicPDF/print-manager-dotnet-core/blob/master/print-manager-dotnet-core-cs/ByteArrayExample.cs){#gitlink-id target=_blank}


[ByteArrayExample.vb](https://github.com/DynamicPDF/print-manager-dotnet-core/blob/master/print-manager-dotnet-core-vb/ByteArrayExample.vb){#gitlink-id target=_blank}

Documentation version