We help IT Professionals succeed at work.

Check out this week's podcast, "Dairy Farms to Databases: Community's Hand in Technology"Listen Now

x

how to send escape codes to the printer?

cadenza
cadenza asked
on
2,404 Views
Last Modified: 2012-06-22
Hi,

a friend of mine has to work with a printer that uses the generic Windows printer driver. To change font attributes like 'bold' he has to send an escape sequence to the printer. However, the printer driver replaces the non-printable characters by '@', making such changes impossible. Now there are two questions:

1- is there a 'neutral' windows printer driver available wich does not filter out the escapes?
2- (if 1 does not work) he tried to use windows API calls like ExtEscape, but could not get them to work. How could he use the TPrinter object and mix this with ExtEscape?

I know he could write directly to the printer port, but ofcourse it would be preferable to use as much Delphi + windows as possible.

Thanks,

Wim
Comment
Watch Question

Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Hi ZifNab,

Jules Verne let one of his characters say:

"use what you've got, so that you won't need what you've not"

and this seems to hold for us too! I passed your answer to my friend and he is testing it at the moment. I think that if it does not work for him (because maybe the generic windows printer driver does not have this capability ?) he is out of luck. I'll be back soon,

Wim

Commented:
If you still have problems sending code directly to the printer, simle solution I've been using lattely is to write text to a temporary text file and copy file to the LPT at the end of the printing job.
It works perfectly with Delphi 2.0 and NT 4.0.

Author

Commented:
ZifNab:

The generic windows printer driver does not have the PASSTHROUGH capability, so I am afraid that is not the way to go. Strange, though, since this driver is the one most likely to need passthrough!!

Smico:

Thanks. I'll pass your answer to my friend and will be back soon.

Wim

Author

Commented:
ZifNab: you answered the question, and although it did not give the definitive solution, I'll give you the points.

Smico: thanks for your suggestion. It amounts more or less to writing to the port directly, a thing we wanted to avoid, and was implied in the question already. Unfortunately I don't see a way to give you points too. Sorry.

Wim
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.