﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss Content Posted by Jereme Guenther / Article Discussions / Article Discussions by Author  / Printing in .NET / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sat, 18 May 2013 17:54:29 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>If I may, you can add the following lines to allow the user to select any printer using the print dialog in vb.net. Thanks for the coding, by the way.' provide the user a dialog with which to choose his weapon! Dim sysPrinter As New PrintDialog()        sysPrinter.ShowDialog()         Dim myprinter As Object = sysPrinter.PrinterSettings.PrinterName  'carry over the user's choices                 ' Create object, passing in text        Dim MyPrintObject As New TextPrint(docDocument)        ' Set font, defaults to times new roman, 12 if omitted        MyPrintObject.Font = New Font("Arial", 11)             MyPrintObject.DefaultPageSettings.PrinterSettings.PrinterName = myprinter  'effect the change from default printer to your choice        ' Issue print command        MyPrintObject.Print()That does it! The use of "docDocument" was a sub that created the formatted document from raw text before sending to the printer.</description><pubDate>Tue, 25 Dec 2012 17:31:56 GMT</pubDate><dc:creator>FlaCop</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>There are two different areas:If you want to adjust the height of actual places try this line:[code="vb"]ymin += CInt(the_font.Height)[/code]If you want to adjust the height of actual lines of text.[code="vb"]layout_rect = New RectangleF(xmin, ymin, e.MarginBounds.Right - xmin, the_font.Height)[/code]and[code="vb"]If layout_rect.Height &amp;lt; 1 Then layout_rect.Height = 1[/code]</description><pubDate>Sat, 03 Dec 2011 10:13:40 GMT</pubDate><dc:creator>Jereme Guenther</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>[quote][b]Jereme Guenther (11/30/2011)[/b][hr]I'm not in a position to be able to test this at the moment, i'm deployed to Afghanistan, but I believe you can manipulate this line to increase the left hand margin:[code]Dim xmin As Integer = e.MarginBounds.Left[/code][/quote]Thanks for reply...I've modified it using 'e.MarginBounds.Left / 100' to put left margin to 0 and &amp;lt;ST=...&amp;gt;One more question..When I decrease the font size, the space between 'vbCrLf' s doesn't dynamically change. I means the smaller the font size the greater the space between 'vbCrLf' s.Could you give me clue how to manipulate the code to make the spaces change dynamically to fit the font size?thanks....</description><pubDate>Sat, 03 Dec 2011 07:12:28 GMT</pubDate><dc:creator>djtechwork</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>I'm not in a position to be able to test this at the moment, i'm deployed to Afghanistan, but I believe you can manipulate this line to increase the left hand margin:[code]Dim xmin As Integer = e.MarginBounds.Left[/code]</description><pubDate>Wed, 30 Nov 2011 18:59:19 GMT</pubDate><dc:creator>Jereme Guenther</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>jereme,How modify the layout margin (left, top)?</description><pubDate>Wed, 30 Nov 2011 03:49:23 GMT</pubDate><dc:creator>djtechwork</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>Nice catch, I wouldn't have thought of that; but it makes perfect sense now that you mention it.</description><pubDate>Thu, 16 Nov 2006 11:35:00 GMT</pubDate><dc:creator>Jereme Guenther</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;Never mind I figured it out, sort of. &lt;/P&gt;&lt;P&gt;I tried the code without the tahoma font, and it works fine. I looked in my fonts directory and there was a tahoma and a tahoma Bold, but no Tahoma Italics.  &lt;/P&gt;</description><pubDate>Thu, 16 Nov 2006 11:12:00 GMT</pubDate><dc:creator>Colin Hobby</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;Jereme, the only mod I made to your code is to add the Italics in the chekbold function, &lt;/P&gt;&lt;P&gt;hereis what i changed, let me know if this is what you had intended:&lt;/P&gt;&lt;P&gt;[code]&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;P&gt;For&lt;/FONT&gt;&lt;FONT size=2&gt; varPlace = 1 &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;To&lt;/FONT&gt;&lt;FONT size=2&gt; varString.Length&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/FONT&gt;&lt;FONT size=2&gt; Mid(varString, varPlace, 3) = "&amp;lt;B&amp;gt;" &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;printStyle = FontStyle.Bold&lt;/P&gt;&lt;P&gt;varPlace += 2&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ElseIf&lt;/FONT&gt;&lt;FONT size=2&gt; Mid(varString, varPlace, 4) = "&amp;lt;/B&amp;gt;" &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;printStyle = FontStyle.Regular&lt;/P&gt;&lt;P&gt;varPlace += 3&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ElseIf&lt;/FONT&gt;&lt;FONT size=2&gt; Mid(varString, varPlace, 4) = "&amp;lt;ST=" &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;varStartPlace = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;CInt&lt;/FONT&gt;&lt;FONT size=2&gt;(Mid(varString, varPlace + 4, _&lt;/P&gt;&lt;P&gt;InStr(varPlace + 4, varString, "&amp;gt;") - (varPlace + 4)))&lt;/P&gt;&lt;P&gt;varPlace += 4 + varStartPlace.ToString.Length&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ElseIf&lt;/FONT&gt;&lt;FONT size=2&gt; Mid(varString, varPlace, 3) = "&amp;lt;I&amp;gt;" &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;printStyle = FontStyle.Italic&lt;/P&gt;&lt;P&gt;varPlace += 2&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ElseIf&lt;/FONT&gt;&lt;FONT size=2&gt; Mid(varString, varPlace, 4) = "&amp;lt;/I&amp;gt;" &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;printStyle = FontStyle.Regular&lt;/P&gt;&lt;P&gt;varPlace += 3&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Else&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ReDim&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Preserve&lt;/FONT&gt;&lt;FONT size=2&gt; aryString(3, aryString.GetUpperBound(1) + 1)&lt;/P&gt;&lt;P&gt;aryString(0, aryString.GetUpperBound(1) - 1) = _&lt;/P&gt;&lt;P&gt;Mid(varString, varPlace, 1)&lt;/P&gt;&lt;P&gt;aryString(1, aryString.GetUpperBound(1) - 1) = printStyle&lt;/P&gt;&lt;P&gt;aryString(2, aryString.GetUpperBound(1) - 1) = _&lt;/P&gt;&lt;P&gt;varStartPlace&lt;/P&gt;&lt;P&gt;varStartPlace = -1&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt; [/code]&lt;/P&gt;</description><pubDate>Thu, 16 Nov 2006 10:57:00 GMT</pubDate><dc:creator>Colin Hobby</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>I'm sorry Colin, but I can't duplicate your problem.  Using my code with the addin I gave you I was able to successfully print your problem code in italics with no missing letters.  I would guess that you have made some other modification to the program to cause this.</description><pubDate>Wed, 15 Nov 2006 17:06:00 GMT</pubDate><dc:creator>Jereme Guenther</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;Jereme, &lt;/P&gt;&lt;P&gt;here is my PrintObject string.....&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt;&lt;FONT size=2&gt; MyPrintObject &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;New&lt;/FONT&gt;&lt;FONT size=2&gt; TextPrint("&amp;lt;B&amp;gt;Equipment Agreement Form&amp;lt;/B&amp;gt;" _&lt;/P&gt;&lt;P&gt;+ vbCrLf + vbCrLf + "&amp;lt;B&amp;gt;Name: &amp;lt;/B&amp;gt;" + Trim(oEmployee.LastName) + ", " + Trim(oEmployee.FirstName) + vbCrLf + "&amp;lt;B&amp;gt;Title: &amp;lt;/B&amp;gt;" + Trim(oEmployee.Title) + vbCrLf + "&amp;lt;B&amp;gt;Department: &amp;lt;/B&amp;gt;" + Trim(oEmployee.Department) + vbCrLf + "&amp;lt;B&amp;gt;Site: &amp;lt;/B&amp;gt;" + oEmployee.Site + vbCrLf + "&amp;lt;B&amp;gt;Floor: &amp;lt;/B&amp;gt;" + Trim(oEmployee.Floor) + vbCrLf + "&amp;lt;B&amp;gt;Start Date: &amp;lt;/B&amp;gt;" + Trim(oEmployee.StartDate) + vbCrLf + "&amp;lt;B&amp;gt;Transfer Date: &amp;lt;/B&amp;gt;" + Trim(oEmployee.TransferDate) + vbCrLf + "&amp;lt;B&amp;gt;Termination date: &amp;lt;/B&amp;gt;" + oEmployee.TermDate + vbCrLf + "________________________________________________________________________" + vbCrLf + "&amp;lt;B&amp;gt;Room Number: &amp;lt;/B&amp;gt;" + Trim(oEmployee.RoomNumber) + vbCrLf + "&amp;lt;B&amp;gt;Telephone: &amp;lt;/B&amp;gt;" + Trim(oEmployee.TelephoneLine) + "&amp;lt;B&amp;gt; Extension: &amp;lt;/B&amp;gt;" + Trim(oEmployee.Extension) + vbCrLf + "&amp;lt;B&amp;gt;Long Distance Code: &amp;lt;/B&amp;gt;" + Trim(oEmployee.LDcode) + vbCrLf + "&amp;lt;B&amp;gt;Meditech Access: &amp;lt;/B&amp;gt;" + Trim(oEmployee.MedTechIssu) + "&amp;lt;B&amp;gt; Issue Date: &amp;lt;/B&amp;gt;" + Trim(oEmployee.MedTechIssued) + vbCrLf + "&amp;lt;B&amp;gt;PC: &amp;lt;/B&amp;gt;" + Trim(oEmployee.PcIssued) + "&amp;lt;B&amp;gt; Issue Date: &amp;lt;/B&amp;gt;" + Trim(oEmployee.PCDate) + vbCrLf + "&amp;lt;B&amp;gt;Outlook: &amp;lt;/B&amp;gt;" + Trim(oEmployee.EmailIssued) + "&amp;lt;B&amp;gt; Issue Date: &amp;lt;/B&amp;gt;" + Trim(oEmployee.EmailIssueDate) + vbCrLf + "&amp;lt;B&amp;gt;Internet: &amp;lt;/B&amp;gt;" + Trim(oEmployee.InternetIssued) + "&amp;lt;B&amp;gt; Issue Date: &amp;lt;/B&amp;gt;" + Trim(oEmployee.InternetDate) + vbCrLf + "&amp;lt;B&amp;gt;Transcription: &amp;lt;/B&amp;gt;" + Trim(oEmployee.TranscriptionID) + "&amp;lt;B&amp;gt; Issue Date: &amp;lt;/B&amp;gt;" + Trim(oEmployee.TranscriptionDate) + vbCrLf + "&amp;lt;B&amp;gt;Pager: &amp;lt;/B&amp;gt;" + Trim(oEmployee.PagerIssued) + "&amp;lt;B&amp;gt; Issue Date: &amp;lt;/B&amp;gt;" + Trim(oEmployee.PagerDate) + vbCrLf + "&amp;lt;B&amp;gt;Cell Phone: &amp;lt;/B&amp;gt;" + Trim(oEmployee.CellIssued) + "&amp;lt;B&amp;gt; Issue Date: &amp;lt;/B&amp;gt;" + vbCrLf + "&amp;lt;B&amp;gt;Other Equipment: &amp;lt;/B&amp;gt;" + vbCrLf + vbCrLf + "&amp;lt;B&amp;gt;Keys: &amp;lt;/B&amp;gt;" + vbCrLf + vbCrLf + "&amp;lt;B&amp;gt;Parking Permit: &amp;lt;/B&amp;gt;" + Trim(oEmployee.ParkingID) + " &amp;lt;B&amp;gt;Permit Number: &amp;lt;/B&amp;gt;" + Trim(oEmployee.PermitNumber) + vbCrLf + "&amp;lt;B&amp;gt;Issue Date: &amp;lt;/B&amp;gt;" + Trim(oEmployee.ParkingID) + vbCrLf + "&amp;lt;B&amp;gt;Handicap: &amp;lt;/B&amp;gt;" + Trim(oEmployee.handicap) + "&amp;lt;B&amp;gt; Lot Assigned: &amp;lt;/B&amp;gt;" + Trim(oEmployee.Lot) + vbCrLf + "&amp;lt;B&amp;gt;Badge: &amp;lt;/B&amp;gt;" + Trim(oEmployee.BadgeID) + "&amp;lt;B&amp;gt; Issue Date: &amp;lt;/B&amp;gt;" + Trim(oEmployee.BadgeID) + vbCrLf + vbCrLf +  &lt;FONT size=2&gt;&lt;STRONG&gt;"&amp;lt;I&amp;gt;I agree to return items and equipmnet to my department manager at time of termination. Failure to return items or equipment will result in value of items to be withheld from final paychek or accrued leave.&amp;lt;/I&amp;gt;" &lt;/STRONG&gt;&lt;/FONT&gt;+ vbCrLf + "&amp;lt;B&amp;gt;Employee Signature: &amp;lt;/B&amp;gt;" + "____________________" + vbCrLf + "&amp;lt;B&amp;gt;Print Name: &amp;lt;/B&amp;gt;" + "____________________" + vbCrLf + "&amp;lt;B&amp;gt;Date: &amp;lt;/B&amp;gt;" + "______/_____/_________", defPrinter)&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;this code will print the Bolded line as ....( and in Italics too)&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;EM&gt;" ag ee  o  e u n   ems an  equ pmne  o m   epa  men  manage  a   me o   e m na  on.  a u e  o  e u n  ems o  equ pmen    esu   n a ue o  ems  o be    hh   om   na  pa che  o  acc ue   ea e."&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description><pubDate>Wed, 15 Nov 2006 14:22:00 GMT</pubDate><dc:creator>Colin Hobby</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;Hey kmsultan, I am a little confused about the question.  If you are the one creating the webpage which needs to be printed then you should have the data itself and can properly format it another way.  If you are going for clientside printing you can use the javascript print feature, which will have the user select a printer to print to.&lt;/P&gt;&lt;P&gt;If you really need to print using the HTML code itself then you will probubly need to look at using an HTML parsing engine like gecko (which firefox uses).  I have never attempted that before and would seriously look at your options before starting something this major.&lt;/P&gt;&lt;P&gt;Jereme&lt;/P&gt;</description><pubDate>Wed, 15 Nov 2006 11:54:00 GMT</pubDate><dc:creator>Jereme Guenther</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;Jereme,&lt;/P&gt;&lt;P&gt;     Thanks for the great effort.  I tried your code, and it works.  My problem however is that I'm trying to print an HTML document in .net &lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: 'MS Mincho'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: JA; mso-bidi-language: AR-SA"&gt;programmatically&lt;/SPAN&gt;!  I've tried a few tutorials, but they all seem to be centered around sending text to the printer.  &lt;/P&gt;&lt;P&gt;Have you come across examples where html docs can be sent to the printer easily? I'm sure there must be an easy way, but I haven't come across it yet.&lt;/P&gt;&lt;P&gt;By the way, I tried to read my html as a string, and then use your class to print it, however all I got to print was the actual html code and not the rendered html document.&lt;/P&gt;&lt;P&gt;Appreciate your help.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description><pubDate>Wed, 15 Nov 2006 10:51:00 GMT</pubDate><dc:creator>kmsultan</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;What is the string that you are trying to print?  I mean the full string including the formatting tags like &amp;lt;I&amp;gt;.&lt;/P&gt;&lt;P&gt;What do you mean by "not printing every letter"?  Is it not printing the actual character, or is it simply printing the character without italics?&lt;/P&gt;</description><pubDate>Mon, 13 Nov 2006 12:44:00 GMT</pubDate><dc:creator>Jereme Guenther</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;Jereme, Thanks for the italics code, I added it to the checkbold method, and it does print italics, however it does not print every letter in the string. It skips the first 2 char, prints the 3rd,skips the 4th,prints the 5th and 6th, skips 7th, print 8th,skip 9th. prints 10, skips 11, prints 12, skips 13,prints 14,skips 15+16, prints 17-21, skips 22 prints 22-25 etc.. &lt;/P&gt;&lt;P&gt;&lt;img src='images/emotions/confused.gif' height='20' width='20' border='0' title='Confused' align='absmiddle'&gt;    &lt;/P&gt;</description><pubDate>Mon, 13 Nov 2006 09:04:00 GMT</pubDate><dc:creator>Colin Hobby</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;Text formatting is taken care of in the checkBold method.  I know the name doesn't really fit it, but that is what happens when you are a little green when writting the code and don't properly plan it.&lt;/P&gt;&lt;P&gt;For italics you would add something like this (not tested):            ElseIf Mid(varString, varPlace, 3) = "&amp;lt;I&amp;gt;" Then                printStyle = FontStyle.Italic                varPlace += 2            ElseIf Mid(varString, varPlace, 4) = "&amp;lt;/I&amp;gt;" Then                printStyle = FontStyle.Regular                varPlace += 3&lt;/P&gt;&lt;P&gt;The font size would be taken care of in the same place.  I would use a tag such as &amp;lt;SIZE=?&amp;gt; &amp;lt;/SIZE&amp;gt;.  A change like this will require you to understand the code fairly well and make a few changes to the main print method to implement it.&lt;/P&gt;&lt;P&gt;Unfortunately, the project this code belongs to has been put on hold for awhile so I have been unable to complete it.&lt;/P&gt;</description><pubDate>Fri, 10 Nov 2006 13:55:00 GMT</pubDate><dc:creator>Jereme Guenther</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;How can I make certain lines of text italics, i am using this class in a WinForm, and it works really great as far as the actual printing goes. But I dont know how to format the text. for example If I want to have a Headline in a bigger font, do I instantiate another myPrintObject ? &lt;/P&gt;</description><pubDate>Fri, 10 Nov 2006 13:33:00 GMT</pubDate><dc:creator>Colin Hobby</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;Sure saeed,&lt;/P&gt;&lt;P&gt;1) If you will look at the code in the article you can use the following exerpt to identify the correct location for changing the code.  The code you quoted is what you are suppose to change it to.                ' See if any characters will fit.                &lt;FONT color=#dd3333&gt;If characters_fitted &amp;gt; 0 Then&lt;/FONT&gt;                    ' start accumulating the print location                    varWord(varWord.GetUpperBound(0) - 1) = layout_rect                    ' ************Draw the word when finished.************...                    '' Draw a rectangle around the text (for debugging)....                    ' Increase the location where we can start.                    xmin += CInt(text_size.Width) - 4                    ReDim Preserve varWord(varWord.GetUpperBound(0) + 1)                &lt;FONT color=#dd3333&gt;ElseIf Asc(smallArray(0, x).Chars(0)) &amp;lt; 30 Then&lt;/FONT&gt; ' make sure to dispose of odd char's in the array&lt;/P&gt;&lt;P&gt;2) I assume from your post that you also read right to left so you need the entire printing process reversed.  This is much simpler than reading left to right but printing right to left.  I haven't actually tested this but the solution should be as simple as replacing the red code with the green:                    ' ************Draw the word when finished.************                    If Asc(smallArray(0, x).Chars(0)) = 32 Or x = smallArray.GetUpperBound(1) - 1 Then                        Dim z As Integer                        For z = x - (varWord.GetUpperBound(0) - 1) To x                            ' Get the font for measurement.                            the_font = New Font(fntPrintFont.Name, fntPrintFont.Size, CInt(smallArray(1, z)), fntPrintFont.Unit)                            ' actually print the character on the page.&lt;FONT color=#dd3333&gt;                            e.Graphics.DrawString(smallArray(0, z), _                                the_font, Brushes.Black, _                                varWord((z - x) + (varWord.GetUpperBound(0) - 1)), string_format)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;                    ' ************Draw the word when finished.************                    If Asc(smallArray(0, x).Chars(0)) = 32 Or x = smallArray.GetUpperBound(1) - 1 Then                        Dim z As Integer                        For z = x - (varWord.GetUpperBound(0) - 1) To x                            ' Get the font for measurement.                            the_font = New Font(fntPrintFont.Name, fntPrintFont.Size, CInt(smallArray(1, z)), fntPrintFont.Unit)                            ' actually print the character on the page.&lt;FONT color=#117711&gt;                            e.Graphics.DrawString(smallArray(0, z), _                                the_font, Brushes.Black, _                                e.MarginBounds.Right - varWord((z - x) + (varWord.GetUpperBound(0) - 1)), string_format)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#117711&gt;&lt;FONT color=#111111&gt;One thing that does have me confused though.  If your native language reads right to left then why isn't the input string being put in right to left which would cause it to be printed out correctly?&lt;/FONT&gt;&lt;FONT color=#111111&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description><pubDate>Mon, 26 Jun 2006 11:02:00 GMT</pubDate><dc:creator>Jereme Guenther</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>Hi,I have two request:1 ) Could you explain me more about the following comment you have already explained and let me know which line should be repleaced. ( The message below the star line)2) I would like to print the characters from right to left because of my native language ( arabic ), could you please give me a hand to solve it.thanks in advance***********************************************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:If Asc(smallArray(0, x).Chars(0)) &lt; 30 Then ' make sure to dispose of odd char's in the array' See if any characters will fit.ElseIf characters_fitted &gt; 0 And xmin &lt; (e.MarginBounds.Right - 5) ThenNotice that I switched the if and elseif lines, that is because I was occasionally printing out a graphical representation for the char(0).**********************************************************</description><pubDate>Sat, 24 Jun 2006 00:39:00 GMT</pubDate><dc:creator>saeed-254117</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>No problem, it is a start.  Let us know if you develop any new cool addons or if you clean it up a bit.</description><pubDate>Thu, 22 Jun 2006 11:48:00 GMT</pubDate><dc:creator>Jereme Guenther</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>Thanks for your nice code and idea.</description><pubDate>Thu, 22 Jun 2006 04:52:00 GMT</pubDate><dc:creator>saeed-254117</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;Hi Veljko,  Bummer by first reply got erased.  Oh well here goes again.  I like your idea, it is a good challenge and one which I didn't think of at the time of development.&lt;/P&gt;&lt;P&gt;For reference e is being passed as &lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;FONT size=2&gt; e &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; Printing.PrintPageEventArgs)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;What I would suggest trying is finding the width of the printable area using something like:&lt;FONT size=2&gt;e.MarginBounds.WidthThen you will have to find the width of the string you are printing by collecting the entire string instead of merely one word.  Use the width of the collected string and the width of the printable area to calculate the new starting location.  Once you have that you can print out the string.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Remember:&lt;FONT size=2&gt;&lt;FONT size=2&gt;If you want to keep the character level formatting then you will still have to loop through the collected string printing one character at a time.Also, don't forget that you can't measure the entire collected string to find out the string width because of the character level formatting.  Instead you will have to collect the widths of each character as you gather the string, then use the some of these widths as your total string width.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;Hope this helps,Jereme&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description><pubDate>Mon, 22 May 2006 10:30:00 GMT</pubDate><dc:creator>Jereme Guenther</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>Hi!This is one of the very rare GOOD code samples for printing I've come accross - good work!!But, I have problems modifying the code.... for example, if I want to add alignment option to the paragraph (center or justified), it looks nearly imposible to insert into code &lt;img src='images/emotions/sad.gif' height='20' width='20' border='0' title='Sad' align='absmiddle'&gt;Do you have any ideas how can this be done?Thanks!</description><pubDate>Sat, 20 May 2006 11:43:00 GMT</pubDate><dc:creator>Veljko Zrnic</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>Hey, all of me hopes it works.  True i did have fun with it but my code is far from perfect.</description><pubDate>Mon, 06 Mar 2006 10:30:00 GMT</pubDate><dc:creator>Jereme Guenther</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;&lt;img src='images/emotions/biggrin.gif' height='20' width='20' border='0' title='Big Grin' align='absmiddle'&gt;&lt;/P&gt;&lt;P&gt;Well part of me hopes it works and part now doesn't hahaha - in any case, it sounds like you had a good time developing &lt;img src='images/emotions/smile.gif' height='20' width='20' border='0' title='Smile' align='absmiddle'&gt;&lt;/P&gt;</description><pubDate>Sun, 05 Mar 2006 21:48:00 GMT</pubDate><dc:creator>Ian Yates</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;I will be a little annoyed with myself if the RichText box idea proves to work in a webpage environment.  That was a lot of work if something better already exists &lt;img src='images/emotions/smile.gif' height='20' width='20' border='0' title='Smile' align='absmiddle'&gt;&lt;/P&gt;&lt;P&gt;The printers I use print to local ports which are UNC paths to the print server.  The print server then sends the job off to the IP port.&lt;/P&gt;</description><pubDate>Sat, 04 Mar 2006 17:26:00 GMT</pubDate><dc:creator>Jereme Guenther</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;I believe there would be an ActiveX control that you could spawn hidden (needn't have a parent window) - The RTF control is standard with Windows.  I have used it in a windowless environment to do similar printing - but I haven't tried using it from .NET though...&lt;/P&gt;&lt;P&gt;As for the printers for the ASP.NET account - are they network printers or local printers attached to the machine or "local printers" in that they are printing to a local printer port but happen to be on the network?&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description><pubDate>Fri, 03 Mar 2006 21:47:00 GMT</pubDate><dc:creator>Ian Yates</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;Hi Ian, thanks for your comments they really add value to this thread.  You have some idea's in there which I didn't think of.&lt;/P&gt;&lt;P&gt;As far as setting up the printers to the asp.net account can use them, I used an account with administrative rights (not the asp.net domain service account) and set up the printers and asp.net was able to see them fine.  This is on a Windows 2000 box, other OS's might not respond so well.  After reading your post I am not sure why my method works, I will have to think on that some more.&lt;/P&gt;&lt;P&gt;I tried spawning an Internet Explorer window, if that is what you are referring to, but it had a few major formatting problems.  In particular, it would cut of the right hand side of the text when it was formatted with a table.  There were a few other security problems and annoyances as well which caused me to dump the idea.&lt;/P&gt;&lt;P&gt;As to using the RichText control, that is a great idea.  I didn't know that asp.net had a native RichText control.  Don't forget that I am working in a web environment with this code.  If it was a simple vb.net application I can think of many better ways for printing nicely formatted text but when I am dealing with web pages which need to print on the server, not client, side I was unable to think of a better solution.  If you know of a way to use a native (or free) RichText control for printing text, where you can control the color of each character, on the server side then please share.&lt;/P&gt;</description><pubDate>Fri, 03 Mar 2006 10:19:00 GMT</pubDate><dc:creator>Jereme Guenther</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;Nice to see a wide variety of articles on the site &lt;img src='images/emotions/smile.gif' height='20' width='20' border='0' title='Smile' align='absmiddle'&gt;&lt;/P&gt;&lt;P&gt;Having said that, two comments.&lt;/P&gt;&lt;P&gt;1. The comment earlier about "no default printer" when the user had a network printer - if ASP.NET is running under a service account it will not have network printers already established - only local printers (LPT, USB, TCP, LPR, etc) printers are, by default, available to service apps.  You'll need to do one of the following&lt;/P&gt;&lt;P&gt;a) call the windows API to connect to a network printer when your app startsb) change the printer to print to LPTx and then issue a NET USE LPTx: &lt;A href="file://\\computer\printer"&gt;\\computer\printer&lt;/A&gt; when your app startsc) run the service under a user account that you have logged on to and set up some printersd) Install the "Print services for Unix" on the computer that is hosting the printer (and then set the service to automatically start!) - you can then set up a TCP printer port printing to that computer - the wizard for this part will say that it cannot detect the type of network card for the printer - don't worry, choose generic &lt;img src='images/emotions/smile.gif' height='20' width='20' border='0' title='Smile' align='absmiddle'&gt;  Then configure the port, change it to LPR and enter in the printer's share name.  Then the printer will be a local printer rather than a network printer and it will be available to all users on the machine - including service accounts&lt;/P&gt;&lt;P&gt;The above has come in very useful when configuring terminal server environments - ensuring all users get all printers without messy scripts and ensuring that permissions on printers and PCs not in the domain do not get in the way (TCP printers don't have any permissions - no shared print queue).&lt;/P&gt;&lt;P&gt;Second point....  &lt;img src='images/emotions/smile.gif' height='20' width='20' border='0' title='Smile' align='absmiddle'&gt; hahahahaI'm not a big .NET programmer but know my way around C# pretty well (I use delphi 99% of the time) - If I had a similar requirement I would probably format my text using RTF and print it using the RichText control?  If I needed HTML syntax then I guess I could spawn explorer - wouldn't this be a lot easier???&lt;/P&gt;&lt;P&gt;Full marks though for sharing the code and working out the nitty gritty stuff! &lt;img src='images/emotions/cool.gif' height='20' width='20' border='0' title='Cool' align='absmiddle'&gt;&lt;/P&gt;</description><pubDate>Fri, 03 Mar 2006 05:22:00 GMT</pubDate><dc:creator>Ian Yates</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;Hi Jereme&lt;/P&gt;&lt;P&gt;Thanks for the update for my printing.&lt;/P&gt;&lt;P&gt;Thanks again for your contirbution!&lt;/P&gt;&lt;P&gt;Howard&lt;/P&gt;</description><pubDate>Thu, 02 Mar 2006 22:43:00 GMT</pubDate><dc:creator>Howard Rybko</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;Hi Min and jkli,&lt;/P&gt;&lt;P&gt;  I always like helping others out.  I have received enough support throughout my life that I like handing out some assistance myself every once in a while.&lt;/P&gt;</description><pubDate>Wed, 01 Mar 2006 19:05:00 GMT</pubDate><dc:creator>Jereme Guenther</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>Thanks for sharing.  It is very generous of you.&lt;img src='images/emotions/smile.gif' height='20' width='20' border='0' title='Smile' align='absmiddle'&gt;</description><pubDate>Wed, 01 Mar 2006 19:02:00 GMT</pubDate><dc:creator>jkli</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>I've not tried your code, but I just want to say thank you for sharing your hardwork with everyone. It's very generous of you.  &lt;img src='images/emotions/smile.gif' height='20' width='20' border='0' title='Smile' align='absmiddle'&gt;</description><pubDate>Wed, 01 Mar 2006 14:22:00 GMT</pubDate><dc:creator>Min-263369</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;Hi alzdba,&lt;/P&gt;&lt;P&gt;  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.&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.developerfusion.co.uk/show/4630/"&gt;http://www.developerfusion.co.uk/show/4630/&lt;/A&gt;&lt;/P&gt;</description><pubDate>Wed, 01 Mar 2006 12:19:00 GMT</pubDate><dc:creator>Jereme Guenther</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description> &lt;DIV&gt;Hi Howard, that is my fault for not giving you all the code to properly initialize the class.  Try the following:&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;P&gt;       ' Create object, passing in text        Dim MyPrintObject As New TextPrint("&amp;lt;B&amp;gt;this will be bold&amp;lt;/B&amp;gt;" + vbCrLf + "&amp;lt;ST=400&amp;gt;this will start at 400 pixels", "MyPrinterName")&lt;/P&gt;&lt;P&gt;Also modify the printing class itself to accept two parameters:&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;' New constructor&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;New&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;FONT size=2&gt; Text &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;String&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;FONT size=2&gt; pName &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;String&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;  ' Sets the file stream&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;  MyBase&lt;/FONT&gt;&lt;FONT size=2&gt;.New()  varStart = 0  strText = Text&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;  MyBase&lt;/FONT&gt;&lt;FONT size=2&gt;.PrinterSettings.PrinterName = pName &lt;FONT color=#008000&gt;' This is the key line for setting the printer&lt;/FONT&gt;  MySplitLine = strText.Split(vbCrLf)&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#111111&gt;I too use exclusively network printers not local LPT1 ports.&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Wed, 01 Mar 2006 12:08:00 GMT</pubDate><dc:creator>Jereme Guenther</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;Hi Jereme&lt;/P&gt;&lt;P&gt;Thanks for this nice piece of work!&lt;/P&gt;&lt;P&gt;I have tried to get it to work in ASP.NET 1.1 (vb) but get a run time error "&lt;SPAN class=Normal id=_ctl0__ctl1_lblMessage&gt;No printers installed." &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=Normal&gt;I do have a deault printer but it is a network printer and not on LPT1.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=Normal&gt;Any ideas?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=Normal&gt;Many Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=Normal&gt;Howard Rybko&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=Normal&gt;&lt;/SPAN&gt; &lt;/P&gt;</description><pubDate>Wed, 01 Mar 2006 02:53:00 GMT</pubDate><dc:creator>Howard Rybko</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>Do you know of a simple way of making a screen-shot (winforms) with .Net code, using the framework (not extra referring to the &lt;FONT color=#800000 size=2&gt;gdi32.dll ) ? &lt;img src='images/emotions/blink.gif' height='20' width='20' border='0' title='Blink' align='absmiddle'&gt;&lt;/FONT&gt;</description><pubDate>Wed, 01 Mar 2006 02:20:00 GMT</pubDate><dc:creator>ALZDBA</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;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:&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;' Prepare the fixed spacing for each character&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt;&lt;FONT size=2&gt; fixedSpace &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; SizeF = e.Graphics.MeasureString("W", the_font)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;Then replace the following line:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;' Increase the location where we can start.&lt;/FONT&gt;&lt;FONT size=2&gt;xmin += &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;CInt&lt;/FONT&gt;&lt;FONT size=2&gt;(text_size.Width) - 4&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;with:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#008000 size=2&gt;' Increase the location where we can start.&lt;/FONT&gt;&lt;FONT size=2&gt;xmin += &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;CInt&lt;/FONT&gt;&lt;FONT size=2&gt;(text_size.Width) - (fixedSpace.Width * 0.25)&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description><pubDate>Wed, 01 Feb 2006 15:16:00 GMT</pubDate><dc:creator>Jereme Guenther</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>&lt;P&gt;Ok, I have found the problem.  Apparently Microsoft has a bug in their &lt;FONT size=2&gt;e.Graphics.MeasureString function.  To remidy this re-organize the primary if block like this:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/FONT&gt;&lt;FONT size=2&gt; Asc(smallArray(0, x).Chars(0)) &amp;lt; 30 &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;' make sure to dispose of odd char's in the array&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;' See if any characters will fit.&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ElseIf&lt;/FONT&gt;&lt;FONT size=2&gt; characters_fitted &amp;gt; 0 &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;And&lt;/FONT&gt;&lt;FONT size=2&gt; xmin &amp;lt; (e.MarginBounds.Right - 5) &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#111111&gt;Notice that I switched the if and elseif lines, that is because I was occasionally printing out a graphical representation for the char(0).&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Wed, 01 Feb 2006 14:27:00 GMT</pubDate><dc:creator>Jereme Guenther</dc:creator></item><item><title>RE: Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>I have noticed a major flaw in this code.  It prints great when using the Tahoma font, but anything else seems to really mess it up.</description><pubDate>Wed, 01 Feb 2006 11:43:00 GMT</pubDate><dc:creator>Jereme Guenther</dc:creator></item><item><title>Printing in .NET</title><link>http://www.sqlservercentral.com/Forums/Topic254843-280-1.aspx</link><description>Comments posted to this topic are about the content posted at &lt;A HREF="http://www.sqlservercentral.com/columnists/jGuenther/printinginnet.asp"&gt;http://www.sqlservercentral.com/columnists/jGuenther/printinginnet.asp&lt;/A&gt;</description><pubDate>Tue, 31 Jan 2006 21:47:00 GMT</pubDate><dc:creator>Jereme Guenther</dc:creator></item></channel></rss>