开发者

VB.Net Printing and Page Margins

I am printing a receipt with the following code:

Dim printFont As New System.Drawing.Font("Courier New", 10, System.Drawing.FontStyle.Regular)
e.Graphics.DrawString(sPrintText, printFont, System.Drawing.Brushes.Black, 10, 6)

sPrintText is a s开发者_StackOverflow社区tring I put together that looks like a basic receipt like this:

http://freeurl.ws/original.jpg

I then save the string to a txt file like this:

Dim f As New IO.StreamWriter(filename, False)
f.WriteLine(texttoprint)

When I open the file in notepad and print it, it comes out like this:

http://freeurl.ws/reprint.jpg

Anyone have any ideas on how I prevent this? I need it to reprint the same way the original did.


I had a similar problem using Star Impact Printer, spend over two days using all codes. At end resolve it by using RawPrinterHelper class available from Microsoft. Here is the code which I have used to open the cash Drawer attached to the printer. s = Chr(&H7); RawPrinterHelper.SendStringToPrinter(receiptprinter, s); You can substitute s for the full Receipt text. It should do graphics as well , but I have not tried it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜