When using the ComponentOne C1.C1PrintDocument.C1PrintDocument to generate and print PDF file, if you received “No printers are installed” exception. It has something to do with the way you set the PrinterSettings. You would think the following codes are the same. But the first one would throw "No printers are installed" exception.
System.Drawing.Printing.PrinterSettings settings = new System.Drawing.Printing.PrinterSettings();
settings.PrinterName = printerIdentifier;
settings.Copies = numberOfCopies;
c1PrintDocument1.Print(settings, false);
So use the following instead.
c1PrintDocument1.PageSettings.PrinterSettings.PrinterName = printerIdentifier;
c1PrintDocument1.PageSettings.PrinterSettings.Copies = numberOfCopies;
c1PrintDocument1.Print(false);
It also happens when trying to set the margins.
No comments:
Post a Comment