printer-ready data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,

i have been trying to send a printer-ready data to an unknown printer to
print. the reason why the printer is unknown is that i do no wish installed
any printer driver. so at the end my printing would have to bypass the
printer driver..

i have read several article on sending file directly to a printer, but i
could not understand how could i get the printername from the
ports(especially when there is no driver install)? Can anyone help me??

regards
youyi
 
Hi Youyi,

I don't know if you'll be able to get a printer name from the port
generically. You can stream it data but in order to get the name I believe
you need to use Escape codes. These codes are what constitutes the printer
driver. The problem is that printers don't use a standard set of escape
codes (if they did we wouldn't need drivers) so in order to get the printer
name you would need to send it the correct escape code for that specific
printer. If you have a standard subset of printers you are working with
then you could find the escape codes for each and then send them all till
you get the name and don't error out (this could back fire if the escape
code to get the name for one actually executes a print for another or worse
changes a setting).

As far as I know I've never come across a way to do what you are doing.
However, maybe research into how Windows does it's Auto-Detect stuff might
lead you down the right path and you would only need to check out the LPT
and Virtual LPT ports (maybe serial too if you are dealing with those). I
would also look into the escape code for the most popular printers you are
dealing with, you might get lucky and the majority of them will use the same
escape code needed...especially if they are mostly different models from the
same vendor. Good luck! Ken.
 
Hi Ken,

thanks, it very informative..may i know how do i send Escape Codes directly
to a printer? I'm actually currently doing VB.net project that test all
USB,IEEE 1284 and LAN connected printers. Will it be different if i will be
using different ports which i have stated above?

=)
youyi
 
Hi Youyi,

I havn't written printer drivers in almost 10 years. Using VB I believe you
would send Chr(27) and then the code. They are called escape codes because
Chr(27) is what the Escape key is usally mapped to. Here is an article on
how to do it with VB, you'll need to rewrite the API declaration for use
with VB.Net:

http://support.microsoft.com/kb/q96795/

Hopefully that article will give you enough keywords to do other searches to
find what you are looking for. You might also want to look for 3rd party
controls. I did a search on the gotdotnet.com user samples but didn't come
up with anything. Also, for the specific escape codes for each printer
you'll need to go to that manufacturer's website and check out their
developer resources. Good luck! Ken.
 
Hi,

The only way, AFAIK, to send data directly to a printer, that bypasses a
printer driver (required if the printer has not been installed) is by
writing directly to the printer parallel port. Since the printer is not
installed, it will not have a name -- so you cannot use FileIO APIs. For
the same reason, you cannot access a USB printer, or a printer on the
network this way.

I have written a PrinterIO ocx that allows direct access to a locally
connected printer (via the parallel port). It bypasses the printer driver
and communicates directly with the hardware. I haven't ported it to .NET,
but the OCX may be used in .NET. If there were sufficient interest, I could
create an equivalent .NET control. Realize, this will not work with any
other than a local printer on a standard parallel port.

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.
 
Hi,

May i know how can i get the PrinterIO ocx I cannot use this for USB or LAN,
is there other alternative?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top