473,748 Members | 3,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(especiall y when there is no driver install)? Can anyone help me??

regards
youyi
Nov 21 '05 #1
6 2563
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...especi ally 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.

"notregiste r" <no*********@di scussions.micro soft.com> wrote in message
news:E6******** *************** ***********@mic rosoft.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(especiall y when there is no driver install)? Can anyone help me??

regards
youyi

Nov 21 '05 #2
Hi Ken,

thanks, it very informative..ma y 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...especi ally 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.

"notregiste r" <no*********@di scussions.micro soft.com> wrote in message
news:E6******** *************** ***********@mic rosoft.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(especiall y 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.

"notregiste r" <no*********@di scussions.micro soft.com> wrote in message
news:1D******** *************** ***********@mic rosoft.com...
Hi Ken,

thanks, it very informative..ma y 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...especi ally 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.

"notregiste r" <no*********@di scussions.micro soft.com> wrote in message
news:E6******** *************** ***********@mic rosoft.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(especiall y 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
22311
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 the selected printer. I'm not concerned about the text format. What I tried is something like this CommonDialog1.ShowPrinter
1
4952
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 we want to print to our HP Laser, we need to know that it is a laser so we can change the font to something comparable. Is there a way to determine what type of printer is selected - i.e. Laser(or deskjet) or Dot Matrix?
0
3657
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 problems have arisen. My investigations show that it is not related to the particular system I developed. but is affecting Access in general. So, has nothing to do with reports being set to print to a default printer (which they all are) or to a...
1
9933
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 reports straight to a printer after a query has run. The user of this db just got a new computer with Windows XP and Access 2002. Now when the user runs the report the following error message is displayed:
0
2592
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 the same reports to 3 different laserjets and to 3 different labelprinters. (They work with the db on 3 different units each with their own Laserjet and Labelprinter) For each unit there is a copy of all the reports. The client can make a unit...
1
12176
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 know how will this affect a report rendered by a crystal viewer. I have a web page with a crystal viewer rendering the report on the page. I build my application in one of my development machines and deploy it
0
1389
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 a printer is not selected for a particular form, the user is prompted to select a printer. The program saves the printer selections to an ini file. THE PROBLEM: This program works well most of the time. On occasion, a specific printer...
2
5781
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 setting the printer's scale and the X,Y position of the output: Sub SetLargePrinterScale(obj As Object, VertPosition As Single) Dim Owid As Single Dim Ohgt As Single Dim Pwid As Single Dim Phgt As Single Dim Xmid As Single
8
2882
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 printer from the default printer for that report to a PDF995 printer (so that i can print it to a file for subsequent emailing) then back to the default Epsom 830 printer? Thanks for any help Phil
4
2034
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. Now let suppose the printer cable is unplagged so the printer is no more reachable: $handle = printer_open($printer_address); // Returns an handle also if the
0
8989
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9537
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9243
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8241
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6795
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.