473,320 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

printer-ready data

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
Nov 21 '05 #1
6 2543
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.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"notregister" <no*********@discussions.microsoft.com> wrote in message
news:E6**********************************@microsof t.com...
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

Nov 21 '05 #2
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

"Ken Dopierala Jr." wrote:
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.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"notregister" <no*********@discussions.microsoft.com> wrote in message
news:E6**********************************@microsof t.com...
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


Nov 21 '05 #3
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.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"notregister" <no*********@discussions.microsoft.com> wrote in message
news:1D**********************************@microsof t.com...
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

"Ken Dopierala Jr." wrote:
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.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"notregister" <no*********@discussions.microsoft.com> wrote in message
news:E6**********************************@microsof t.com...
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


Nov 21 '05 #4
Youri,

What you want is probably only possible on a classic line printer and than
even only using the ASCII characters. The first 127 on a ASCII based code
table, in that code table are as well "printer control" characters. (Inside
the first 30)

http://msdn.microsoft.com/library/de...es_chart_1.asp

I hope this helps something?

Cor
Nov 21 '05 #5
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.
Nov 21 '05 #6
Hi,

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

"Dick Grier" wrote:
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.

Nov 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Patrick Herb | last post by:
Hello, I'm trying to print the content of a RichTextBox from my VB 6 app. What I want is that the CommonDialog shows up, the user selects a printer and the content of the RichTextBox prints to...
1
by: Meyer1228 | last post by:
We're printing invoices using the printer function in VB6. If we print to an IBM-compatible dot-matrix, we can use a font called "12 CPI HSD" which works well, since we want to use 12-pitch. If...
0
by: James Griffiths | last post by:
Here is a report I've written about a printing problem that is being experienced by a particular company for whom I had developed a A97 system. After upgrading to Win XP and AXP, some printing...
1
by: David Trivette | last post by:
I was wondering if anyone could help me with a MS Access 2002 issue I'm having. Problem - I created a db in Access 97 which worked just fine for several years. In the db the user can generate...
0
by: Esmee | last post by:
Hi there, I have created an Access 2002 db which contains several reports. Some reports need to be printed on a Laserjet and others on a Labelprinter. One of my clients wants to be able to print...
1
by: Karthic | last post by:
When i right click on the .rpt file in the VS 2003, i see a property printer setting. It says "No printer" on the top and there is option to select printer and paper settings etc.. I want to...
0
by: Mark | last post by:
Hello, I have a VB6 Project that uses an ini file to save selected printer settings for several forms. The program allows users to select the printer on their work station for printing forms. If...
2
by: cjreynolds | last post by:
Please excuse my cluelessness on the subject - this is the first time I've worked with printing in VB (and it may be the last) and the more I work with it, the more confused I become... First, I'm...
8
by: Phil Stanton | last post by:
Using Access 2000 (Yes I know there is no Printer specified) and an MDE File (Yes I know I can't open a report in design view). Is there any way using VBA of temporarily changing the report's...
4
by: Stefano | last post by:
I've got a problem using printer functions with my network printer shared on another PC as \\192.168.1.3\HP If the printer is connected and reachable, printer_***() functions work correctly. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.