Note that there are some explanatory texts on larger screens.

plurals
  1. POPrint raw data to a thermal-printer using .NET
    text
    copied!<p>I'm trying to print out raw ascii data to a thermal printer. I do this by using this code example: <a href="http://support.microsoft.com/kb/322091" rel="noreferrer">http://support.microsoft.com/kb/322091</a> but my printer prints always only one character and this not until I press the form feed button. If I print something with notepad the printer will do a form feed automatically but without printing any text.</p> <p>The printer is connected via usb over a lpt2usb adapter and Windows 7 uses the "Generic -> Generic / Text Only" driver.</p> <p>Anyone knows what is going wrong? How is it possible to print some words and do some form feeds? Are there some control characters I have to send? And if yes: How do I send them?</p> <p><strong>Edit 14.04.2010 21:51</strong></p> <p>My code (C#) looks like this:</p> <pre><code>PrinterSettings s = new PrinterSettings(); s.PrinterName = "Generic / Text Only"; RawPrinterHelper.SendStringToPrinter(s.PrinterName, "Test"); </code></pre> <p>This code will return a "T" after I pressed the form feed button (This litte black button here: swissmania.ch/images/935-151.jpg - sorry, not enough reputation for two hyperlinks)</p> <p><strong>Edit 15.04.2010 16:56</strong></p> <p>I'm using now the code form here: c-sharpcorner.com/UploadFile/johnodonell/PrintingDirectlytothePrinter11222005001207AM/PrintingDirectlytothePrinter.aspx</p> <p>I modified it a bit that I can use the following code:</p> <pre><code>byte[] toSend; // 10 = line feed // 13 carriage return/form feed toSend = new byte[1] { 13 }; PrintDirect.WritePrinter(lhPrinter, toSend, toSend.Length, ref pcWritten); </code></pre> <p>Running this code has the same effekt like pressing the form feed button, it works fine!</p> <p>But code like this still does not work:</p> <pre><code>byte[] toSend; // 10 = line feed // 13 carriage return/form feed toSend = new byte[2] { 66, 67 }; PrintDirect.WritePrinter(lhPrinter, toSend, toSend.Length, ref pcWritten); </code></pre> <p>This will print out just a "B" but I expect "BC" <strong>and</strong> after running any code I have to reconnect the USB cable to make it work agian. Any ideas?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload