Free Support Forum - aspose.com

Metod PrintDocumentWithSetup in class PdfViewer

Hi!


It says in the API that this method should print document after showing a print dialog in which you can
choose printer. When we uses this method we get a dialog in which you only can select pagesettings.
Are there any plans to include choosing printer in this dialog?

Regards

Daniel Backman

Hi Daniel,


Thanks for your inquiry. You can easily achieve your requirements of displaying print dialog using PrintDialog object. Please check following documentation link/code snippet for details. Hopefully it will serve the purpose.


PdfViewer viewer = new PdfViewer();
viewer.BindPdf(“Input.pdf”);
viewer.AutoResize = true;
viewer.AutoRotate = true;

System.Windows.Forms.PrintDialog printDialog = new System.Windows.Forms.PrintDialog();
if (printDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
System.Drawing.Printing.PrinterSettings ps = printDialog.PrinterSettings;
System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();
pgs.PaperSize = new System.Drawing.Printing.PaperSize(“A4”, 827, 1169);
pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
viewer.PrintDocumentWithSettings(pgs, ps);
}
viewer.Close();

Best Regards,

Hi,


Thanks for the answer I will try your suggestion.

Regards

Daniel Backman