Print at the center
-
Can someone tell me how to print the text at the center of the paper? i am using a receipt print with a maximum of 40 characters per line Proper Planning is way to success
-
Can someone tell me how to print the text at the center of the paper? i am using a receipt print with a maximum of 40 characters per line Proper Planning is way to success
Since you know the width of the printer you pad the beginning of the string with spaces. Take the length of the line you want to print away from the width of the printer, then divide that difference by 2 to get the number of spaces to add on both sides of the test you want to print, but only add it to the beginning of the text:
Dim sText As String = "Text to print Centered" Dim iPad As Integer
iPad = ( 40 - sText.Length ) / 2
sText = New String( Chr(32), iPad ) & sTextRageInTheMachine9532
-
Since you know the width of the printer you pad the beginning of the string with spaces. Take the length of the line you want to print away from the width of the printer, then divide that difference by 2 to get the number of spaces to add on both sides of the test you want to print, but only add it to the beginning of the text:
Dim sText As String = "Text to print Centered" Dim iPad As Integer
iPad = ( 40 - sText.Length ) / 2
sText = New String( Chr(32), iPad ) & sTextRageInTheMachine9532
New string is an unexperted identified. so how?? Proper Planning is way to success
-
New string is an unexperted identified. so how?? Proper Planning is way to success