Re:Printer Selection & Settings via Code
Hi Jay,
to get all installed printers you could use the following:
var i : Integer;
MyPRN : TPrinter;
begin
{Create instance fo printer}
MyPRN := TPrinter.Create;
try
{some combobox}
cbxDruckerEtik.Items.Clear;
{real all available printers and put tehm into combobox}
for i := 0 to MyPRN.Printers.Count-1 do
cbxDruckerEtik.Items.Add(MyPRN.Printers[i]);
finally
{free printer object}
MyPrn.Free;
end;
end;
To use the printer in quickreport first set the windows printer by
setting Printer.Printerindex variable somewhere in you app, then set
the
Quickreport.Printersetting.Printerindex:=Printer.Printerindex;
That's it for the selection of a certain printer.
But I myself have problems to set custom printersettings for the
printout of Quickreport (e. g. to set a custom papersize). I didn't
find a reliable solution yet, so please help in return if you find
something about that issue.
Dirk
On Wed, 8 Mar 2000 16:04:35 -0500, "Jay Jackson" <jjack...@ndcorp.net>
wrote:
Quote
>Hello,
>I have to print out three different QuickReports. Using the VCL
>PrinterSetup component, I can easily select the printer, orientation and
>Source tray. Would do I go about doing this via code? The printer 'driver'
>will be the same of each report - (meaning the user may have named its
>shortcut something different). Here are the items I need to set at runtime:
>Printer : All ways the same, though it will be different than the user's
>default printer.
>Source Tray : The printer support 4 trays
>Orientation : 1 of the three reports are Landscape.
>So, how do I get a list of installed printers on the user's machine, and if
>the correct driver is installed, temporarily make changes to the settings
>above without displaying a dialog box to the user?
>Thanks.
>--
>Jay Jackson
>New Dimensions Consulting
>http://www.ndcorp.net
>Remove the No-Spam to email me.