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!
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center