Preserving selected printer settings

2019-02-15 12:19发布

问题:

I have an application that runs through a series of bookings and prints each in turn in the form of an itinerary to send to clients. Each run could be 30 or so bookings so a need to automate this is required and we have delivered it.

All works well with our report software (Report Builder for DELPHI) except when the user wishes to use Duplex or some other property of the printer. The first print is OK and will Duplex but all other prints revert to the standard settings.

Now I have not found a solution via Report Builder (although their support is pretty good) and was wondering is there a straight forward way at a windows level to save the currently selected printer and ALL of its settings away and then on the next print just reinstate them. I don't mind if it is some VCL etc. I need to buy or just some code I need to cobble together I just need a solution.

回答1:

Actually this is quite a simple task, and then for each report just resend the printerinfo.

See the example at Torry for how to store current setting, you can also get from the printDialog info as well.

If you need a more detailed code sample of how to store and read details to INI file from the printer object let me know, and I will code one up for you.

Regards

RE



回答2:

From the answers given to you in the Digital Metaphors newsgroup it would seem that the ReportBuilder-owned printer setup is going to get applied by them before they output the report, so even if you find the specific solution you are seeking 'at a Windows level', you will still need to find a 'ReportBuilder' solution to get this working. Have you tried the OnInitializePrinterSetup event they suggest?