Board index » delphi » Selecting printer without printer dialog

Selecting printer without printer dialog

Hi there Delphi lovers,

I'm currently working on a database application that makes use of two printers.
The default printer is hooked up to LPT1:. The other one is a label printer and
is hooked up to one of the COM ports.
I'm printing all the reports in the application through the QSD QuickReport
components in Delphi v2.0 C/S.

My problem is how to select the correct printer for my reports without using
the Printer dialog? I.e. the switching of printers must be completely
transparent to the user. The selection of the correct printers will be done
upon installation by smoeone who knows what he/she is doing and the selection
will be stored in the .INI file that goes with the application.

Thanks a mil Aad-Jan
--
/-----------------------------------\
|Aad-Jan Couwenhoven                |
|Software Engineer BSS ProjectLine  |
|FoxPro v2.6x (Win/Dos/Mac)         |
|Delphi v1.0/v2.0                   |
|Clipper v5.2x                      |

Quote
>-----------------------------------<

| Carpe Diem, before anyone else    |
| does.                             |
|              ;-)                  |
\-----------------------------------/
 

Re:Selecting printer without printer dialog


Quote
Aad-Jan Couwenhoven <cou...@dm-visinescu.nl> wrote:
>My problem is how to select the correct printer for my reports without using
>the Printer dialog? I.e. the switching of printers must be completely
>transparent to the user. The selection of the correct printers will be done
>upon installation by smoeone who knows what he/she is doing and the selection
>will be stored in the .INI file that goes with the application.

The Printers property of TPrinter is a list of the names of all the
installed printers. Using the PrinterIndex property of TPrinter you
can select a printer from this list.

e.g.
Printer.PrinterIndex  := 2;

This information can also be found in the help files, just search for
printer or TPrinter.

I hope this helps you,

Onno van Zinderen
zinde...@iaehv.nl

Other Threads