Printer Fonts in VB.Net
I am struggling a great deal with something which was so simple in VB6. I am using an EPSON POS Printer and I need to send the character "A" in the printer font "control" to the printer which opens the till draw.
I have searched and searched and tried and failed to find a way to do this on the internet. I have tried:
- Using a RTF document & a report with the character A but it doesn't accept the printer font
- Using the "Send Raw data directly to printer" help from MSDN but I cant seem to format the data to change the font
- Everything else around on the internet which relates to printer fonts!!
I have received the following code from EPSON to make it work although I don't know how to implement this. What is "UsingGDI"? PrintInfo seems to be a Web control rather than VB.net....
Any help would make me the happiest person alive today!
Private Sub PrintControlCharacter(ByVal e As System.Drawing.Printing.PrintPageEventArgs, ByVal sControlChar As String)
Dim hdc As IntPtr = New IntPtr()
Dim font As IntPtr = New IntPtr()
Dim pInfo As FontInfo
pInfo = New FontInfo("control", 10, 1)
hdc = e.Graphics.GetHdc()
Dim nHeight As Integer
nHeight = -pInfo.nFontSize * UsingGDI.GetDeviceCaps(hdc, 90) / 72
font = UsingGDI.CreateFont(nHeight, 0, 0, 0, 400, 0, 0, 0, _
pInfo.nCharSet, 0, 0, 0, 0,
UsingGDI.TextOut(hdc, 0, 0, sControlChar, sControlChar.Length)
Hi, Jeff: I suspect "UsingGDI" is simply a VB.NET class that declares the API functions used in the code sample. Try searching the Web for "VB.NET" plus the name of each of the API functions used in Epson's code sample; you should be able to find the necessary declare statements.
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL