473,765 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dot matrix printers

Hi!

Can somebody give me a piece of code how to send data to dot matrix printers?
I have used google for example but nothing that can help me. I'm using C#.

Thanx.

J.
Sep 8 '06 #1
4 9437
Joza wrote:
Can somebody give me a piece of code how to send data to dot matrix printers?
I have used google for example but nothing that can help me. I'm using C#.
Hi Joza,

Your Windows application should use the same API for printing to a dot
matrix printer that it does to print to any other printer. As long as
you have the proper Windows driver for your printer, there's nothing
special that you need to do.

The classes that handle printing are found in the
System.Drawing. Printing namespace.

Hope that helps,

--
Sean
Sep 8 '06 #2
"senfo" <en**********@y ahoo.comI-WANT-NO-SPAMwrote in message news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
>
Hi Joza,

Your Windows application should use the same API for printing to a dot matrix printer that it does to print to any
other printer. As long as you have the proper Windows driver for your printer, there's nothing special that you need
to do.

The classes that handle printing are found in the System.Drawing. Printing namespace.

Hope that helps,

--
Sean
Thanx Sean, now I know where to start, but here is another problem; do I must send some
printer esc sequences to printer? If so, what to do if I use several type of printers; for instance,
Epson, Fujitsu... I think that they use different esc seq. I'm asking that because I have created
report in Crystal Report, and report must be printed on A3 paper size. But printing is slow and
I cannot define properly page size through CR. I must use printers options in control panel to
set the page size but that is not good for my users because they do not know how to do that,
especially beacuse some of they have a Epson, some Fujitsu and other types... and for each
printer the options are different. So I must make something unviersal.

Sep 8 '06 #3
Joza wrote:
Thanx Sean, now I know where to start, but here is another problem; do I must send some
printer esc sequences to printer? If so, what to do if I use several type of printers; for instance,
Epson, Fujitsu... I think that they use different esc seq. I'm asking that because I have created
report in Crystal Report, and report must be printed on A3 paper size. But printing is slow and
I cannot define properly page size through CR. I must use printers options in control panel to
set the page size but that is not good for my users because they do not know how to do that,
especially beacuse some of they have a Epson, some Fujitsu and other types... and for each
printer the options are different. So I must make something unviersal.
Hi Joza,

Not a problem, at all. The beauty of using the API is that you don't
have to worry about what language the printer speaks! Page size, etc.
is all provided to you by the classes.

As an example, try this:

1) Start a new VS Windows application
2) Add a TextBox and a Button control to the form
3) Add a PrintDocument component to the form
4) Add code to the buttons Click event handler to print the page. Your
code should look like this:

private void btnPrint_Click( object sender, EventArgs e)
{
printDocument1. Print();
}
5) Add code to the PrintDocuments PrintPage event and add code to handle
print event. Your code should look something like this (don't forget to
add your using directive for the System.Drawing. Printing namespace):

private void printDocument1_ PrintPage(objec t sender, PrintPageEventA rgs e)
{
// Create our default font
Font fnt = new Font("Arial", 10, FontStyle.Regul ar,
GraphicsUnit.Po int);

// Notice additional properties provided by PrintPageEventA rgs
e.Graphics.Draw String(txtMyTex t.Text, fnt, Brushes.Black, 0, 0);
e.HasMorePages = false;
}

To make things interesting, you might want to consider setting the
MultiLine property of the TextBox to true so that it supports more than
a single line of text. At any rate, however, this should print
something, regardless of the kind of printer you have.

One important thing to note is that the PrintPageEventA rgs class
provides MarginBounds and PageBounds properties that can be used to
specify the page settings that you desire.

Hope that helps,

--
Sean
Sep 8 '06 #4
"senfo" <en**********@y ahoo.comI-WANT-NO-SPAMwrote in message news:uz******** ******@TK2MSFTN GP04.phx.gbl...
>
</cut>

Thanx again Sean, some things became clearly to me now. I have also found an
example at msdn for raw printing. Now my task is to get idea how to
send whole resultset in columns like to the printer... This is so
complicated and makes me headache.
Sep 8 '06 #5

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

Similar topics

4
3204
by: Salad | last post by:
I'm developing an app where the print output will be on a dot-matrix printer. I suppose the printers will either be an Epson or Okidata, not really sure at this point. I, unfortunately, do not have a dot matrix anymore. Can I design my reports using TrueType fonts? Should I only use Courrier fonts? And if so, is there a recommended point size? Will page ejects work OK? Any other caveats? Thanks
7
9078
by: trint | last post by:
How can I add all the network printers to a combobox? Thanks, Trint
4
1895
by: Paul H | last post by:
OK, I tried getting and old Newbury Data ND2500 working using the "Generic /Text only" driver in Win XP. It prints, but I could not find a way to set a custom page size that matches the paper I am using. So there was no way it would ever work. The customer is happy to buy another Dot Matrix printer because the ND2500 can be used elsewhere. So which printer should I get that can plug and play with Access? Paul
0
1567
by: Daniel Crespo | last post by:
Hi to all, Does anyone know about how to make a dot matrix printer print a PDF file with the quality of a Microsoft Word printing? When I print from Microsoft Word, the output is perfect for the kind of printer. But, from a PDF file, the characters are distortionated in an uniform way. With "uniform" I mean that no matter where I put the characters in the page, the character "e" always will be smaller than an "a". So, when seeing the...
3
3675
by: Rich Kayton | last post by:
I have an application that is currently a DBASE/Clipper application. We print out a variety of custom labels on Epson DOT matrix printers. I would like to be able to print these labels. I am somewhat familiar with using the commercially available labels but I don't know if I can print my custom designed labels. By custom designed I mean that the line spacing of the preprinted text has been designed with the 10 or 17 characters per inch....
3
6295
by: Adam Right | last post by:
Hi, Anyone knows how to print with dot matrix printer ? I want to print text with some formatting such as bold, underlined font, and landscape document etc... How can i do this with C#? Thanks...
0
1962
by: tasukiph | last post by:
How do I print to a dot matrix printer? I tried using pdf but when I choose to print the document there is always a margin. How do I delete the margins in pdf? Do I have to set the invoice size? How do I dot this since the invoice is wider and shorter than a bond paper? Should I download a special font for dot matrix printers? Thanks!
0
1586
by: Ravigwipro | last post by:
Hi, I m able to get the printers object to know what are the printers had been installed and all. here my requirement is i have to write a data from VB to MS Word. for the page setup i have to get printer info. problem here i m facing is , i m getting the printer info and am able to write the complete document in that case it is working fine..but while generation of document if it gets fail due to some runtime error, in the immediate run...
4
5275
by: Frank Rizzo | last post by:
I basically need a list of printers that's returned by the Find Printers dialog ( http://www.sqleffects.com/mystuff/findPrinters.png ). I've tried the path of DirectoryEntry entry = new DirectoryEntry(strPath); DirectorySearcher mySearcher = new DirectorySearcher(entry); mySearcher.Filter = "(objectCategory=printer)" foreach(SearchResult result in mySearcher.FindAll()) { strName = result.GetDirectoryEntry().Name;
0
9568
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
10007
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...
1
9951
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9832
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
8831
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
7378
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
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3924
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
3
2805
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.