API: DrawText() problem

When using the API DrawText() function for text output
                     
  DrawText(AHandle, '543210', -1, ADrawRect, DT_RIGHT or DTVCenter or DT_SingleLine)

on some printers (mainly newer HP drivers) the last digit is missing in printout. On other printers everything works just fine. The                 DrawRect is much wider than the string. Putting an additional space behind the last digit always solves the problem.

The original Windows HP Laserjet Series II driver never shows this behaviour.

Does anybody know the problem?

Thanks a lot, Roadrunner
(I have asked this Q before in the Delphi-Area)
LVL 1
Roadrunner100598Asked:
Who is Participating?
 
pjknibbsConnect With a Mentor Commented:
Roadrunner: Did you try my suggestion? The other possibility is to specify DT_NOCLIP so the idiot printer driver doesn't try to clip out the last character.
0
 
pjknibbsCommented:
I think you've said everything you need to say with "newer HP drivers"--HP can't write printer drivers to save their lives. Although I haven't seen this particular problem, I'd suggest passing the actual length of the string to DrawText() instead of -1 and see if that fixes it.
0
 
MDarlingCommented:
Have you tried using DrawText with DT_CALCRECT (to get the rectangle ADrawRect), so that you can use it in the
Drawing call to DrawRect?

regards,
Mike.
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
Roadrunner100598Author Commented:
To MDarling:
I normally use DT_CALCRECT first.
I even tried DT_CALCRECT, then added some pixels to Rect.Right... no use.
0
 
MDarlingCommented:
Fair enough - i have a very new cheap HP deskjet at home - do you want to give me some sample code to try on it?

regards,
Mike.
0
 
chensuCommented:
'543210' should be "543210". I suppose it is just a typo.
0
 
Roadrunner100598Author Commented:
to Pjknibbs:
The turn around cycle for testing is a bit long - all my computers do not show the problem, so I have to run all tests on a customers PC via PC-anywhere etc., so please be patient. DT_NOCLIP sounds very promising indeed! I just looked it up in my API reference...

to chensu:
Aktually no typo but delphi syntax - for C you're right of course
0
 
SubramanyaCommented:
Test
0
 
Roadrunner100598Author Commented:
DT_NOCLIP solved my problem!!!

Thanks a lot,

Roadrunner

(Sorry I took so long evaluating your comment)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.