Hello, everyone! I am setting up printing (to a printer or file) in my application, and it doesn't seem to print out any new lines that I specify. Here's some of my printing code:
Here are the definitions for the TextArray array:Code:' Loop through all of the text in the array For i = 0 To 9 If i Mod 2 = 0 Then TheFont = SpecialFont Else TheFont = NormalFont End If ' Find out how many characters will fit in the printing area e.Graphics.MeasureString(TextArray(i), TheFont, New SizeF(PrintAreaWidth, PrintAreaHeight), fmt, NumCharsFit, NumLinesFilled) ' Print the text on the page e.Graphics.DrawString(TextArray(i), TheFont, Brushes.Black, rectPrintingArea) ' Add how many characters were printed onto the page CurrentChar += NumCharsFit Next
When I print the output to a PDF file using PDFCreator, it stacks all of the letters onto each other rather than creating new lines at the places I've specified. I've also tried using vbNewLine instead of vbCrLf, but I haven't had any luck. I searched the web for this but couldn't find anything about it. Any help would be greatly appreciated!Code:Dim TextArray(0 To 9) As String ' Find out the text we're going to print TextArray(0) = "Order Number: " TextArray(1) = txtOrderNum.Text & vbCrLf TextArray(2) = "Order Date: " TextArray(3) = txtOrderDate.Text & vbCrLf TextArray(4) = "Order Time: " TextArray(5) = txtOrderTime.Text & vbCrLf & vbCrLf TextArray(6) = "Employee that processed the order: " TextArray(7) = txtEmployee.Text & vbCrLf TextArray(8) = "Customer: " TextArray(9) = txtCustomer.Text & vbCrLf For i = 0 To 9 TextLength += TextArray(i).Length Next




Reply With Quote
