C# PDF Print - How to Send a PDF to a Printer.
We can use C# / Visual Basic code to easily print a PDF in .net applications using IronPDF.
WE can send a PDF directly to a printer silently (programatic printing), or create a System.Drawing.Printing.PrintDocument object which can be worked with and sent to GUI print dialogs.
using IronPdf; // Create a new PDF and print it IronPdf.HtmlToPdf Renderer = new IronPdf.HtmlToPdf(); PdfDocument Pdf = Renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf"); // Send the PDF to the default printer to print Pdf.Print(); //For advanced silent real-world printing options, use PdfDocument.GetPrintDocument //Remember to addan assembly reference to System.Drawing.dll System.Drawing.Printing.PrintDocument PrintDocYouCanWorkWith = Pdf.GetPrintDocument();
Imports IronPdf ' Create a new PDF and print it Private Renderer As New IronPdf.HtmlToPdf() Private Pdf As PdfDocument = Renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf") ' Send the PDF to the default printer to print Pdf.Print() 'For advanced silent real-world printing options, use PdfDocument.GetPrintDocument 'Remember to addan assembly reference to System.Drawing.dll Dim PrintDocYouCanWorkWith As System.Drawing.Printing.PrintDocument = Pdf.GetPrintDocument()
Adobe Acrobat Reader not Required
There is no stable way to achieve PDF printing without having a PDF library such as IronPDF installed. Attempts to do this without a C# PDF library rely on hacks involving Adobe Acrobat reader being installed on the client, which is nether reliable nor best paractice.