Hi Fabio,
TImageEnView.PdfViewer.Print doesn't choose a printer itself. It prints to the global VCL Printer object in Vcl.Printers. That object starts on the Windows default printer, so unless your code changes it, the job goes there.
When you call Print( True ) and the user picks a printer in the print dialog, the dialog changes that same Printer object.
To print to a specific printer without showing the dialog, set Printer.PrinterIndex before calling Print:
uses
Vcl.Printers;
var
idx: Integer;
begin
idx := Printer.Printers.IndexOf( 'HP LaserJet M404' ); // Name as listed in Windows
if idx >= 0 then
Printer.PrinterIndex := idx;
ImageEnView1.PdfViewer.Print( False );
end;
Notes:
- To go back to the system default printer, set Printer.PrinterIndex := -1.
- This setting applies to your whole application, so later printing also uses that printer until you change it.
- Orientation, number of copies and similar settings also come from Printer, so you can set those the same way before printing.
Nigel
Xequte Software
www.imageen.com