|
n PDF Viewer, How to Directly print the PDF File without selection of Printer (Directly Print as per printer name set by code) |
We can directly print PDF document by setting the printer name through code level. Please find the below code snippet to print the document through PdfViewerControl.
We can also set the printer name in code level through PrintDialog class while silent printing the document. Please find the KB link from below. https://www.syncfusion.com/kb/4625/how-to-silent-print-a-pdf-document-to-a-specified-printer | |
|
How to get the Direct Print Button Click Event in PDFViewer, so that PDF can directly print as per the printer name set by coding. |
We can use the ‘ButtonClicked’ event of PdfViewerControl, to set the printer name while printing the document. The ‘ButtonClicked’ event is triggered when we click the buttons in the PdfViewerControl’s toolbar.
Please find the below code snippet to trigger the ButtonClicked event.
Please find the sample from below link: http://www.syncfusion.com/downloads/support/forum/140408/ze/Print-189439324 Please find the video illustration for the same. http://www.syncfusion.com/downloads/support/forum/140408/ze/Video-2114991372 |
Is there a way to know if the Print is success or fail or user cancelled or what exactly happend to log?
In WPF PdfViewer, The EndPrint event is triggered when the last page of the document has been printed. However, it is also triggered if the printing process is canceled or if an exception occurs during the process.
MSDN link:PrintDocument.EndPrint Event (System.Drawing.Printing) | Microsoft Learn