Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printer Location?

Status
Not open for further replies.

SpeedDemon

Programmer
Jan 1, 2001
70
GB
Hi all, thanks for all the help so far :)

Right o, im trying to print some text to the printer, which is working perfectly.

However, how do I change which printer the print comannds go to? Better yet, is there a way to see the printers currently installed in windows??

Cheers all!
 
The simplest way of doing this is to use the print dialog box. Alternatively you could use a quickreport and the user can select which printer to use when you display a preview.
 
Hi, thanks for the reply.

How do I go about doing this??

Cheers
 
Just drop a PrinterSetupDialog1 component onto your form, add a button and hive the buttons on click event the following code.

PrinterSetupDialog1.Execute;

The standard windows printer setup dialog will appear where your users can select a different printer if they wish.
 
Champion, i didnt know about that drop in.

So now thats running, how exactly do you send data to the printer to be printed?

The old..

with printer do
begin
etc etc
end;

Do you use this or something else?

Cheers
 
Personally, I always have to make complicated reports so I use the QuickReport included with Delphi. There some known issues with it and there is probably better software out there but Im familiar with the QuickReports now. There are plenty of examples in the help file on using quickreports but as a general rule all you need to do is drop a quickreports onto your form (Its quite large so you might want to create a new form), add at least one QRBand (if you add three you can set on as type page header, footer and detail). You can then use the other components in the quickreport tab to make some good looking reports (just assign data as you would if you were using labels or DBEdits etc). Once youve assigned all your data to the report, call its preview method and you have a print preview (ala msword) which you can then print from. Or you can print without the preview, its upto you.
 
Hi Eric,
Can you help me with this.
I have used quick report to make a report.
I have two printers on my network.
what i want to do is print all the pages except the last page of the report on the first printer and then print the
last page on the second printer.
How do I do this.
Is there any event of the quick report components to get this done????
 
I dont think there is an easy way of doing this if at all. You can use the OnEndPage event to stop printing a report but you cant actually specify which page to start printing a quickreport from. Sacnning the help file if you check out the frequently asked questions section QRQA205 explains this in more detail and also has an example.
 
Hi all, well, my knowledge is increasing.

I ended up printing my reports manually using the canvas option, they look fantastic.

Earl, if you generate your reports manually, u can get the last page to the second printer.

the printer.printers variable holds a list of all the printers installed on your pc, the variable seperates the printers with the ascii codes #13#10 (it might just be #13 or #10 on its own, i havent checked as I decided to make my system print to the defualt printer automatically).

You can quite easily loop through the variable to print to the screen all the different printers installed, the printer.printerindex property (might be wrong, check the helpfiles, its all in there) hold an interger value of the current selected printer, 1 beign the first printer, 2 the second etc.

When you get to print to the last page, you can simply switch the printerindex value (there might be a little more to it, search for printer in the help, all in there) and it should print to another printer... fingers crossed... may require a little experimentation ;)

Taz.
 
If you use the preview option in quick report you can manage your printer, you can determine with the setup button, to which printer to print and/or which pages.

Regards S. van Els
SAvanEls@cq-link.sr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top