Click here to Skip to main content
15,041,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone
I ma working in a small pos application, everything is done except the printing bill. I am trying to generate 58 mm bill receipt using a thermal printer using a text file. I write data on text file, but my question is how can I set the document paper width, also format the document to be more good design , not just so simple..

What I have tried:

TextWriter writer = new StreamWriter(@"C:\test\test.txt");
           writer.WriteLine("Data e faturimit:    " + DateTime.Now);
           writer.WriteLine("                   PRIMUS");
           writer.WriteLine("-----------------------------------------------------");
           for (int i = 0; i < dtgartikuj.Rows.Count - 1; i++)
           {
               writer.Write(dtgartikuj.Rows[i].Cells[1].Value.ToString() + "\t" + dtgartikuj.Rows[i].Cells[2].Value.ToString() + "\t" + dtgartikuj.Rows[i].Cells[3].Value.ToString() + "\t" + dtgartikuj.Rows[i].Cells[4].Value.ToString() + "\t" + dtgartikuj.Rows[i].Cells[5].Value.ToString() + "\t" + "\r\n");
           }
           writer.WriteLine("");
           writer.WriteLine("-----------------------------------------------------");
           writer.WriteLine("Totali:  " + totali.Text);
           writer.WriteLine("Vlera e TVSH" + textBox1.Text);
           writer.WriteLine("Faturimi" + faturimi);

           writer.Close();
           MessageBox.Show("Data Exported");

What i ma trying to do is like this receipt in https://c1.neweggimages.com/ProductImage/AFJU_1316929619769029994Lo3OH09x3.jpg"
Posted
Updated 13-Oct-20 22:10pm
Comments
Gerry Schmitz 13-Oct-20 13:20pm
   
This usually depends on the "brand" of printer; i.e. read the fluent manual for the printer.

1 solution

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