Page 1 of 1

Error when trying to use Print Preview

Posted: Wed Oct 10, 2012 6:04 pm
by ntavendale
I keep getting an exception when using the print preview and there is no default windows printer for user. Is there any way to assign a printer and have the previewer render for that?

Posted: Thu Oct 11, 2012 6:06 pm
by Sergey Tkachenko
You cannot use a preview or print if Printer.PrinterIndex = -1
(Printer is defined in Printers unit)

Posted: Tue Oct 16, 2012 12:07 am
by ntavendale
Would there be any way to have it prompt for a printer (with a dialog), or assign a printer if this is the case, or simply use the firt one on the list of printers that are there?

My problem is that my users are using the app through a Citrix Metaframe server which will often forget to set up the default printer for them when they log in.

It keeps generating exceptions and these clog up my bug server.

Posted: Tue Oct 16, 2012 6:31 am
by Sergey Tkachenko
You can do it yourself:

Code: Select all

if (Printer.PrinterIndex<0) and (Printer.Printers.Count>0) then
  Printer.PrinterIndex := 0;