I have a Crsytal Report with the size 4x2, which is printing bill in a shop.
Printer is TVS JuSTBILL printer [Thermal Printer].
Its working, but at the time of printing after printing the actual text, the printer through lots of paper out from the printer like 2 to 3 inches paper[Roll paper does not have any fixed height, width is 4 inches]. That paper go wasted.
It is the problem.
Can we stop the printer after printing the actual printing, so that any blank page will not go wasted.
How to stop printer to eject extra paper from printer.
I am using the following code.
private void button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(GlobalClass.constr);
con.Open();
SqlDataAdapter da3 = new SqlDataAdapter("select * from SalesDetails where BillNo='" + textBox1.Text + "'", con);
DataSet ds3 = new DataSet();
da3.Fill(ds3, "SalesDetails");
rptSalesbill abc = new rptSalesbill();
abc.SetDataSource(ds3.Tables[0]);
System.Drawing.Printing.PrintDocument printDoc = new System.Drawing.Printing.PrintDocument();
int i;
int rawKind = 0;
for (i = 0; i < printDoc.PrinterSettings.PaperSizes.Count; i++)
{
if (printDoc.PrinterSettings.PaperSizes[i].PaperName == "4x2")
{
rawKind = (int)GetField(printDoc.PrinterSettings.PaperSizes[i], "kind");
}
}
abc.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)rawKind;
abc.PrintToPrinter(1, true, 0, 0);
crystalReportViewer1.Refresh();
}
private object GetField(Object obj, String fieldName)
{
System.Reflection.FieldInfo fi = obj.GetType().GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
return fi.GetValue(obj);
}
Please Help me, I,m not getting any perfect answer regarding this question.