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

Free Support Forum - aspose.com

Print dialog

hi I have a code below that does the silent PDF print.

how can I have a print dialog so they user can choose the printer name.

public void PrintWithAspose() {

var license = new License();


// open input PDF file


// set attributes for printing

_pdfviewer.AutoResize = true; // Print the file with adjusted size

_pdfviewer.AutoRotate = true; // Print the file with adjusted rotation

_pdfviewer.PrintPageDialog = false; // Do not produce the page number dialog when printing

// Create objects for printer and page settings and PrintDocument

var ps = new PrinterSettings();

var pgs = new PageSettings();

var prtdoc = new PrintDocument();

// Set printer name to user default printer

ps.PrinterName = prtdoc.PrinterSettings.PrinterName;

// Set PageSize (if required)

pgs.PaperSize = new PaperSize(“A4”, 827, 1169);

// Set PageMargins (if required)

pgs.Margins = new Margins(0, 0, 0, 0);

// Print document using printer and page settings

_pdfviewer.PrintDocumentWithSettings(pgs, ps);

// Close the PDF file after priting



Hi Nermin,

Thanks for your inquiry. Please use PrintDialog object to invoke Print dialog for printer selection. Please check following code snippet for the purpose. Hopefully it will help you to accomplish the task.

printDialog = new System.Windows.Forms.PrintDialog();<o:p></o:p>

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


// Document printing code goes here <o:p></o:p>

// Print document using printer and page settings <o:p></o:p>

ps); <o:p></o:p>



Please feel free to contact us for any further assistance.

Best Regards,