We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to Preview the PDF before printing it in Aspose.Pdf for .NET


I have a requirement where i need to preview the PDF before printing it.

I have seen below link which is updated in the year 2011. May i know is there any solution for the requirement in Aspose.Pdf for .NET.

<a href="https://forum.aspose.com/t/99040#</a>

Hi Rajesh,

Thanks for contacting support.

I am afraid Aspose.Pdf for .NET does not support the feature to invoke preview dialog when printing the document. Also please note that Aspose.Pdf for .NET does not invoke print dialog because this is what you can do in your program. In fact, Aspose.Pdf for .NET has means to use printer and page settings for printing pdf documents. For instance, you may try using the following code snippet.


Aspose.Pdf.Facades.PdfViewer viewer = new Aspose.Pdf.Facades.PdfViewer();<o:p></o:p>


viewer.AutoResize = true;<o:p></o:p>

viewer.Resolution = 600;<o:p></o:p>

viewer.AutoRotate = true;<o:p></o:p>

viewer.PrintPageDialog = true;<o:p></o:p>

PrintDialog printDialog = new PrintDialog();<o:p></o:p>

if (printDialog.ShowDialog() == DialogResult.OK)<o:p></o:p>


System.Drawing.Printing.PrinterSettings ps = printDialog.PrinterSettings;<o:p></o:p>

System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();<o:p></o:p>

pgs.PaperSize = new System.Drawing.Printing.PaperSize(“A4”, 827, 1169);<o:p></o:p>

pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);<o:p></o:p>

viewer.PrintDocumentWithSettings(pgs, ps);<o:p></o:p>