Click here to Skip to main content
14,883,296 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to print barcodes from crystal reports. What we are failing to perform is printing it to CENTER of page sized 5.199*2.600 cm .We are missing something. This is a freelance work we are doing from home. Our work is not complete until generation of barcodes possible. All other works are done. We don't have zebra printer of client with us to check fast test cases. So we have to take builds each time and have to wait for client reply on it. Client is supportive to us since we don't have experience on this before. Codes we tried are commented. Output we got is not fitting inside the paper.
barcode error - Album on Imgur[^]

Any suggestions.

What I have tried:

private void barcode_Click(object sender, EventArgs e)
          {
              try
              {

                  if (txtbarqty.Text != null)
                  {
                      for (int qt = 0; qt <= Convert.ToInt32(txtbarqty.Text); qt++)
                      {
                          ds.Rows.Add(txtID.Text, txtName.Text, txtRate.Text);
                          cry.Load("CrystalReport3.rpt");
                          cry.SetDataSource(ds);
                          crystalReportViewer1.ReportSource = cry;
                      }
                  }
                          cry.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.DefaultPaperOrientation;
                          cry.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.DefaultPaperOrientation;
                          cry.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.DefaultPaperSize;
                          cry.PrintToPrinter(Convert.ToInt32(txtbarqty.Text),false, 0, 0);
                  
          
                      //crystalReportViewer1.PrintReport();
                      txtbarqty.Text = "";
                      if (Application.OpenForms.OfType<products>().Count() == 1)
                          Application.OpenForms.OfType<products>().First().Close();
                      products pr = new products();
                      pr.Show();
                  
              }
              catch (Exception ex)
              {
                  //mb5 fur = new mb5();
                  //fur.Show();
                  //MessageBox.Show(ex.ToString());
              }
          }
Posted
Updated 30-Oct-20 5:09am
v2
Comments
Member 14941856 30-Oct-20 11:19am
   
What i am going to try next is this.
https://hub.acctivate.com/articles/resolve-page-size-issues-on-reports
I dont know this will helps or not.
Gerry Schmitz 30-Oct-20 13:11pm
   
You're saying you need the client to tell you that the bar code is not printing in the proper place? Don't you have a specification and a ruler? Maybe the client can lend you a ruler. A "printer" won't fix "that" problem.

https://answers.sap.com/questions/204591/how-to-center-a-report-object-such-as-text-object-.html

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