Click here to Skip to main content
15,946,158 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi every one i try to make Customer Receipts using PrintDocuments Control and now i want to display the footer on Customer Receipts. The Foter Text stored in a string type Variable.
String Fotertex="ABC DEF GHIJK LMNOP QRSTUVWXYZ AAA BBBBBBB ABCD";
but i use thermal printer for Customer Receipts.
and the text that display only in foter is "
ABC DEF GHIJK LMNOP
"
Now i want it automatically break the line and the renaming Text "
QRSTUVWXYZ AAA BBBBBBB ABCD
" Display on Next line.
i simply want if the text Character greater then 19 it break the line and printer the renaming text in Next line.
Thanks in advance

What I have tried:

i try this but its not working i dont know why its not working
if (Fotertex.ToString().Length > 19)
          {
              graphics.DrawString(Fotertex.ToString().Substring(0, 19), myfont, Brushes.Black, new Point(10, startY = startY + 40));
          }
Posted
Updated 20-Mar-19 4:40am
Comments
Richard MacCutchan 20-Mar-19 8:40am    
i dont know why its not working
What does that mean?
Fahid Zahoor 20-Mar-19 9:33am    
i means that
this line of code not working
if (Fotertex.ToString().Length > 19)
{
graphics.DrawString(Fotertex.ToString().Substring(0, 19), myfont, Brushes.Black, new Point(10, startY = startY + 40));
}
Richard MacCutchan 20-Mar-19 9:35am    
And what does "not working" mean? Please do not expect us to guess what happens when you run your code.

1 solution

A "form" or "window" (WPF) with a TextBlock or TextBox or RichTextBox with "Text Wrapping On" using Canvas positioning or visual to (bmp) imaging will solve your problem. This will also allow you to "save as PDF".
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900