views:

2279

answers:

5

Hello,

Hopefully somebody will be able to help. In my Delphi 7 application small percentage of users report errors when printing and I'm trying to resolve this with last of them. I'm slightly limited when it comes to testing (as user is physically distant and we are working it out via e-mail), but I get some additional information from EurekaLog.

Anyway, first error that he got is "Operation not supported on selected printer", at this line of code:

Printer.Orientation := AOrientation;

So, I assumed that his printer doesn't support Orientation (I never heard of this, but I guess it's possible) and tried without this line of code. But now he gets "Printer selected is not valid" at this line:

Result := Printer.PageWidth / GetDeviceCaps(Printer.Handle, LOGPIXELSX);

As far as I know, printer is correctly selected (it's Canon Pixma iP1500, but other users have other models, inkjet or laser), and he already tried to update drivers. OS also varies - from XP to Vista SP1).

I suggested to him to try with another printer, but whatever he responds, I don't know where to look next. Google search didn't give any useful results (for me, at least). Does anyone have an idea?

Thanks in advance!

+2  A: 

You say that a small percentage of users report the problems. Do you have any idea what is the difference between these and the other users?

In think about:

  • used printers
  • printer drivers (version)
  • OS used, including patches and updates (don't forget the IE updates)
  • version of your software
  • other installed software

Do the users have print problems with other applications?

It would be a great help if you could reproduce the problem.

Gamecat
Thank you for your answer. While I get system information from those who do report problem, I have no idea if it works to others with similar systems (there's thousands of them and not all submit an error report if it happens).
vrad
+3  A: 

Not a direct solution, but it may help solve the problem. First thing I do with this sort of problem is get the exact driver version from the customer, and then download the driver and install it on my PC, using LPT1. I can then print against it for testing, and resolve any issues with the driver. Obviously I can't actually print, but that isn't usually a problem. Using a virtual machine helps a lot too.

mj2008
+2  A: 

Not a solution but a tip for reducing the bug surface: Install (or have the user install) a virtual printer on that system and try to print to that one. A free (both as in beer, and as in freedom) virtual PDF printer comes with the excellent PDFCreator. It definitely supports page orientation. That will give you a known good baseline against which to test.

Mihai Limbășan
Excellent advice.
mghie
Yes, I did suggested PDFCreator but I'm still waiting for answer (time zone difference). Still, I have no idea what to do next no matter of results. I hoped that someone had similar problem before.I'll mark all answers as helpful (because they are), but I will leave question open for now.
vrad
A: 

You may need to tweak delphi's printer.pas - there are a few bugs in printer implementation at least with older delphi versions, e.g. if network printer UNC name is too long delphi may crash.

Tom
Thanks. Is there any list of these bugs? Maybe already updated version? Quick Google search don't give much results.
vrad
+1  A: 

I have a customer with what sounds like the same (or at least a similar) problem. The line of code where we get the "Printer selected is not valid" message is slightly different (in the quick reports library), but it is similarly a call to GetDeviceCaps.

While we have yet to find a real solution, we have found a workaround. If the user visits the "Printer Setup" dialog before attempting to print the report, the error does not appear.

Have you had a look at these sites that I have found with some help from Google:

http://www.delphipages.com/threads/thread.cfm?ID=19871&G=19828

http://www.contactplus.com/cfaq/index.php?qid=381&catid=4

Scott W