Jump to content
Geoff88

Delphi 5 Printing

Recommended Posts

Is anybody aware if Win 10 has changed its API in regard to printing?  My flagship program has been running for 20yrs but suddenly 2 customers who have purchased new HP printers have found they cannot print from it.  Then yesterday another custome found they could not print to an older Canon printer despite loading the newest drivers and also despite other programs being able to print.  Has everybody moved over to GDI printing? and if so is there a Delphi 5 solution?

Share this post


Link to post

TPrinter/TCanvas is GDI printing.

It's likely that there are bugs in TPrinter in Delphi 5 that has since been fixed. I seem to recall that there were quite a lot of them. Buffer overflows and whatnot.

 

What has happened is probably that your application has been using GDI in a way that was invalid but was worked around by Windows and now they've stopped working around it.

  • Like 1

Share this post


Link to post

Thanks for those inputs.  From what you have said, and since the program is working quite happily on many other computers including the development machine, I have a suspicion that it may be the drivers and not Windows after all.

Share this post


Link to post

@Geoff88:

 

ShellExecute(Application.Handle, PChar('print'), PChar('A:\Path\to\a\file\to\print.pdf'), PChar(''), nil, SW_HIDE);

you can let windows handle everything with that.

this would open whatever programm is associated to print that file.

 

//edit

if you want full control, customized-printing-in-delphi, here you find everything you need.

Edited by KodeZwerg

Share this post


Link to post

Had the same problem, solved it by selecting a different printer, that appeared in my printers list, when I installed my new HP-deskjet printer. Printer name is "HP Smart Printing". I selected that printer as default.

Share this post


Link to post

A few years back Microsoft released an update that broke printing on Epson Dot Matrix printers. Fortunately it was quickly fixed with a follow-up update as so many financials still work on Dot Matrix printers. We had a busy week that week.

https://www.cprou.com/information/windows-update-breaks-dot-matrix-printers/

 

There are other similar cases. One being;

https://www.bleepingcomputer.com/news/microsoft/new-windows-10-kb5006670-update-breaks-network-printing/

 

Share this post


Link to post

Anything new on this? I am having the same problem with HP and Canon wireless printers under both Delphi 11 and Delphi 6. All printing from my Delphi programs fails on these printers, whether drawing to the printer canvas or using AssignPrn and writing text to the device.

My customers can dump to pdf and print from there, but I was hoping there was a fix, or at least a better work-around, since for some of them, switching printers is not an option.

 

Share this post


Link to post
6 hours ago, Thuddeus said:

Anything new on this? I am having the same problem with HP and Canon wireless printers under both Delphi 11 and Delphi 6. All printing from my Delphi programs fails on these printers, whether drawing to the printer canvas or using AssignPrn and writing text to the device.

My customers can dump to pdf and print from there, but I was hoping there was a fix, or at least a better work-around, since for some of them, switching printers is not an option.

 

it is very funny that blaming Delphi for bugs on printer driver (usually this is the source of trouble) will solve this problem.
the most reliable way to solve this problem is to communicate with printer driver author.
explain your problem and send them your most simple program that show where the problem is.

however reaching the author is not as easy at all.

Share this post


Link to post

This may or may not be relevant, but this thread reminded me of a fix I made a while back, adding the following line to my printing code

 

  Printer.Title := ProgName + ' calcs ';   // 11.11.18 latest Win10 update falls over without this
 

  • Confused 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×