Hello Syncfusion!
We've been looking for ways to print an already created PDF, and the PDFViewer in your project seemed like it would be perfect for this task.
As I am already aware, it is possible to silently print an existing PDF to the default printer the following way:
public void Print(string fileName, PrinterSettings settings)
{
PdfViewerControl viewer = new PdfViewerControl();
viewer.Load(fileName);
viewer.PrinterSettings.ShowPrintStatusDialog = false;
viewer.Print(false);
}
As you can tell however, we pass already know PrinterSettings (from System.Drawing.Printing) to this method, as we've already shown a PrintDialog (from System.Windows.Forms) to the user long before calling the actual print action here, as we use other libraries as well in regards to various user's configurations.
There does not seem to be any way for us to supply these known PrinterSettings (ie FromPage/ToPage, PrinterName) to the printing action, and the PrinterSettings available within the PdfViewerControl itself are inadequate for this purpose.
Additionally, looking around I found out that at some point the viewer.PrintDocument property was of the type System.Windows.Forms.PrintDocument, which would've allowed us to simply pass the document to a new (hidden) PrintDialog with the PrinterSettings we already know, but this is now a System.Windows.Documents.FixedDocument instead, meaning the code presented on the following page no longer works:
https://www.syncfusion.com/kb/4625/how-to-silent-print-a-pdf-document-to-a-specified-printer.
Is there any way to replicate the code in the link above in the current version of this control, perhaps via a workaround if needed?
Thanks for your help in advance!