Error when trying to use Print Preview

General TRichView support forum. Please post your questions here
Post Reply
ntavendale
Posts: 16
Joined: Sun Oct 10, 2010 6:05 pm

Error when trying to use Print Preview

Post 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?
Sergey Tkachenko
Site Admin
Posts: 17524
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You cannot use a preview or print if Printer.PrinterIndex = -1
(Printer is defined in Printers unit)
ntavendale
Posts: 16
Joined: Sun Oct 10, 2010 6:05 pm

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17524
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can do it yourself:

Code: Select all

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