Ok, I have found the problem. Apparently Microsoft has a bug in their e.Graphics.MeasureString function. To remidy this re-organize the primary if block like this:
Notice that I switched the if and elseif lines, that is because I was occasionally printing out a graphical representation for the char(0).
Another update, I have perfected the variable character spacing problem when the font size and type changed. Add the following line somewhere above The 'Static i As Integer' line:
Then replace the following line:' Increase the location where we can start.xmin += CInt(text_size.Width) - 4
with:' Increase the location where we can start.xmin += CInt(text_size.Width) - (fixedSpace.Width * 0.25)
Thanks for this nice piece of work!
I have tried to get it to work in ASP.NET 1.1 (vb) but get a run time error "No printers installed."
I do have a deault printer but it is a network printer and not on LPT1.
' Create object, passing in text Dim MyPrintObject As New TextPrint("<B>this will be bold</B>" + vbCrLf + "<ST=400>this will start at 400 pixels", "MyPrinterName")
Also modify the printing class itself to accept two parameters:
I too use exclusively network printers not local LPT1 ports.
I have never tried taking a screen shot in .net. Here is a link on how to do it but I does appear that you will need to use API functions.