using IronPdf;
// Create a new PDF and print it
var renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf");
// Send the PDF to the default printer to print
// 300 DPI, no user dialog this time ... many overloads to this method
pdf.Print(300);
//For advanced printing we can also use PdfDocument.GetPrintDocument
//Remember to add an assembly reference to System.Drawing.dll or System.Drawing.Common via NuGet.
System.Drawing.Printing.PrintDocument printDocYouCanWorkWith = pdf.GetPrintDocument();
Imports IronPdf
' Create a new PDF and print it
Private renderer = New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf")
' Send the PDF to the default printer to print
' 300 DPI, no user dialog this time ... many overloads to this method
pdf.Print(300)
'For advanced printing we can also use PdfDocument.GetPrintDocument
'Remember to add an assembly reference to System.Drawing.dll or System.Drawing.Common via NuGet.
Dim printDocYouCanWorkWith As System.Drawing.Printing.PrintDocument = pdf.GetPrintDocument()
El fragmento de código anterior demuestra cómo imprimir un documento PDF usando la biblioteca IronPdf en .NET. Incluye opciones para imprimir con el cuadro de diálogo de impresión predeterminado de Windows o de forma silenciosa, y muestra cómo utilizar el objeto nativo PrintDocument para configuraciones de impresión más avanzadas. Asegúrese de incluir una referencia a System.Drawing.dll si está utilizando el objeto PrintDocument para configuraciones personalizadas.