Click here to Skip to main content
12,250,675 members (40,665 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: SQL-server-2005 C#2.0 C# , +
I have a bill format made thorough crystalreports where the page width is 4 inch and height is dynamic[I make it 2 inch, I don't know how to make it dynamic].
printer is TVS RP-45 Justbill printer.
printer is wasting lots of paper by ejecting paper after printing,
please suggest the way to stop the paper waste.
Any other way except crystalreporting will be helpful for me.
My Code is wrtten in c#2.0 winforms, database sql server 2005.
stucture of my report is
Report Header Section
                      Bill no : 101
______________________________________________
Detail Section
Item Code               Qty           Amount
[ItemCode]             [Qty]         [Amount]
______________________________________________
Report Footer Section
Grand Total                      [GrandTotal]
______________________________________________


My three section is taking around 2 inch height so I set the Height of the paper to 2 inch,
But still lots of paper is wasted. Paper height is now multiply by 2 if there is more than 1 item.
[My Paper is a Roll Paper where Height is not fixed, it should depends on No. of Item to be sold]

Whatever might be the way, but I need to print the bill without wasting any paper.
Please Please Please help!
Posted 4-Sep-12 3:19am
Edited 4-Sep-12 12:40pm
v6
Comments
Sandeep Mewara 4-Sep-12 15:40pm
   
Not clear on what are you trying to share and seek help for technically!
Sourav Sarkar-SS 4-Sep-12 16:46pm
   
I am talking about extra paper ejecting by printer after printing task.
After printing the actual document printer eject some extra paper that paper go waste.
I have modified the question

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

> open notepad doc copy paste below text
Report Header Section
                      Bill no : 101
______________________________________________
Detail Section
Item Code               Qty           Amount
[ItemCode]             [Qty]         [Amount]
______________________________________________
Report Footer Section
Grand Total                      [GrandTotal]
______________________________________________
> set font 'courier new'
> open printer settings set papersize & printer
check paper is wasting or not

It will definitely work in text document


create bill dynamically,
billstr= feedcutstr("heading",36,right) + vbnewline; //create feedcutstr function in which you paas string and width & alignment as per that it will feed characters with spaces so string will be become 36 characters
e.g input "headings" output -> "             headings               "
 
billstr+= feedcutstr("--------------------------------------",36,right) + vbnewline;
for(i=0;i<dtbill.rows.count;i++)>
   {
        if (i==0)
        {  
            billstr += feedcutstr("ItemCode",20,Left) + feedcutstr("Qty",5,right) + feedcutstr("Amount",11,right)+ vbnewline; 
            billstr+= feedcutstr("--------------------------------------",36,right) + vbnewline;
        }
        billstr += feedcutstr(dtbill.rows[i]["itemcode"],20,Left) 
        billstr += feedcutstr(dtbill.rows[i]["Qty"],5,right) 
        billstr += feedcutstr(dtbill.rows[i]["Amount"],11,right) + vbnewline;
   }

// now, write bill str in text file
StreamWriter sw = new StreamWriter("D:\\Test.txt");
//Write a line of text
sw.WriteLine(billstr);
//Close the file
sw.Close();

//then print notepad file(your bill)
objProcess.StartInfo.FileName = "D:\\test.txt";
                    objProcess.StartInfo.Verb = "Print";
                    objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                    objProcess.StartInfo.UseShellExecute = true;
                    objProcess.Start();

Happy coding!
Smile | :)
  Permalink  
Comments
Sourav Sarkar-SS 5-Sep-12 12:24pm
   
Thank you so much.
I will try and let you inform about this.
But there are couple of question
1. open printer settings set papersize & printer
[is it for notepad and how to do this? and if I set the pa[er size again then will the same thing will happend like in crystal report?]
2. Whenever I print a notepad file directly from notepad it says
[Page too small to print one line
Try printing using smaller font]

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 5 Sep 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100