views:

244

answers:

3

Hi,

I am using a dot matrix printer and have to do a continious printing job.

The paper I use is 213mm X 350mm and splitted at the middle of the page.

I've tried something and I am able to print the first side of the page but the prints are shifted when it comes to the second part of the page?

Is there any tutorial which explains how to do this from scracth, including what the printer's settings should be.

I am coding with c# but i guess .Net's library is not suitable for this.

Any suggestions?

+1  A: 

Maybe looks a bit odd, but before a while we've done printing from Windows to the matrix printers using something like this

  1. write contents to a file (using printers escape sequences when needed; writing FF (form feed) where page should end; you need to have corrent page size set on printer)
  2. shell exec "copy file.txt lpt1:"
Nightingale7
Thanks for the reply.But my printer uses usb port ;)I was able to make the right settings and now I can print from a text file in Windows environment.But I have to print from the code. I've tried to send the same text file to the printer from the code, but after the first page the printer head continues where it stayed.How can I send the formfeed command from the code.Or is there a way to tell the code to use the form I've created in windows.
caisenm
A dot-matrix printer on a USB port -- that just blew my mind a little.
harpo
A: 

Here's what I have done:

My printer was OKI 3320. I've found its manual and learned the printer's escape characters.

I've prepared a string template to match the formatting. Including tags for variables, "carriage return", "line feed" and "form feed" escape sequences.

I've measured my papers length and set my printers rear feed page length according to it. By doing that, when I send the printer FF command, it will adjust the printer to the next form's starting point.

In my application I've taken the string replaced the tokens with apropritate values and send them to printer using RawPrinterHelper. Since the RawPrinterHelper only supports English characters, I had to replace the Turkish characters also.

It works fine now.

Of course there may be more professional approaches. You can totally control your printer by using escape sequences. You can give coordinates of the print area or set the page length programmatically which eliminates the need for configuring printer. Since my application shall be uses once only, my solution is adequate for me.

caisenm
A: 

Maybe looks a bit odd, but before a while we've done printing from Windows to the matrix printers using something like this

1.write contents to a file (using printers escape sequences when needed; writing FF (form feed) where page should end; you need to have corrent page size set on printer) 2.shell exec "copy file.txt lpt1:"

Can Nighttingale7 explain this further:

  • will printing like this preserve the font type and font size of the file? If so, how are we to set the font type and font size when writing data to the file?
Lou