I am trying to print a receipt. Very basic, don't want a print preview or anything like that. Just want to hit the receipt button in the form and have it spit one out. It works, but prints 2 pages every time - one with data, one blank. This is what I have:
private void button3_Click(object sender, EventArgs e) {
TextBox receipt = new TextBox();
receipt.Text = "I hate print problems" + Environment.NewLine;
PCPrint printeng = new PCPrint();
printeng.PrinterFont = new Font("Courier New", 10);
printeng.TextToPrint = receipt.Text;
printeng.PrinterSettings.FromPage = 1;
printeng.PrinterSettings.ToPage = 1;
printeng.Print();
}
I threw in the frompage/topage in hopes that would work, but it still cranks out two pages. I had read that if the data is too large it can cause this, so I removed the meat of the receipt and just put that one line of text and I still get two pages.
Any ideas?
Loading
KenPosted Jan 2, 2012, 9:24 PM
Sam HobbsPosted Jan 2, 2012, 9:18 PM
I hope this helps you the next time you need to print.
KenPosted Jan 2, 2012, 8:46 PM
*shrug*
Well, either way, I got what I need so it's all good. Thanks.
Sam HobbsPosted Jan 2, 2012, 2:07 AM
Not all applications want the print to be the same and then they need to have special code for printing but Windows makes it easy to print if you want to print what you see in a window. Which means that if you want to you could create a form and print the form.
KenPosted Jan 2, 2012, 1:39 AM
Sam HobbsPosted Jan 1, 2012, 9:09 PM
KenPosted Jan 1, 2012, 8:03 PM
Sam HobbsPosted Jan 1, 2012, 7:13 PM
If it were me, I would look at the other members of the PCPrint object. There might be something relevant there. In particular, the paper type and/or dimensions and/or the print width and height would be worth looking at.
KenPosted Jan 1, 2012, 11:07 AM
Dharmesh SharmaPosted Jan 1, 2012, 8:32 AM
If you use webpasge
In your case may be case page has larg height and any other esuess
so you use this code
thanks