locked
Print Raw data to printer RRS feed

  • Question

  • Hi,

    First of all. I hope I'm in the correct forum. If not let me know :-)

    I have a job, where I have to print a printercode (Raw data) to a label printer (Citizen CLP621). I found this tutorial to do that: http://support.microsoft.com/?kbid=322091.

    When using the code I print to the label printer. No errors but it only prints a blank page, not any text at all. I tried to give it some code for the printer without success. Then I tried to print a text string (no code at all in it) also without any success.

    Can anyone help me to figure out, why it doesn't print anything at all?

    My code:

    private void button2_Click(object sender, EventArgs e)
            {
                System.Drawing.Printing.PrintDocument pd = new System.Drawing.Printing.PrintDocument();
    
                if (cbPrinter.SelectedIndex != -1)
                {
                    string printerToUse = cbPrinter.Text;
                    if (!printerToUse.Equals(""))
                        pd.PrinterSettings.PrinterName = printerToUse;
    
                    pd.OriginAtMargins = true;
                    pd.DefaultPageSettings.Margins = new System.Drawing.Printing.Margins(20, 20, 0, 20);                
                    
                    if (checkBox1.Checked)
                    {
                        RawPrinterHelper.SendStringToPrinter(pd.PrinterSettings.PrinterName, "HereIsMyCodeForThePrinter");
                    }
                    else
                    {
                        RawPrinterHelper.SendStringToPrinter(pd.PrinterSettings.PrinterName, "LD11PGpGSGA21F1102100100010000199590101");
                    }
    
                    pd.Print();
                    this.labelsprinted = 0;
                }
                else
                {
                    MessageBox.Show("Vælg en label printer");
                }   
            }
    

    I can see it go into the printer (prints a blank page) but it doesn't print anything on the paper (also not when I choose the string "HereIsMyCodeForThePrinter".

    If I choose to make a bitmap image and print this to the printer it print the bitmap image out.

    I really hope someone can help me. I'm stucked into this and don't know what to do.

    Kind regards,
    simsen :-)

    Tuesday, October 25, 2011 12:01 PM

All replies

  • Why you need raw print? Is this matrix printer to get max speed? Use DrawText to print text.

    Tuesday, October 25, 2011 1:52 PM
  • Hi ABC07

    I need raw print to print a barcode. When I try to print a barcode using DrawText it fails an put out the commandos like a string. And no I cann't use the C# program to draw a barcode like an image file and send this to the printer. It prints it out but the scanner cannot read this barcode (if printing the image out to a laserprinter the scanner can read it). So I have to let the printer it self draw the barcode.

    Wednesday, October 26, 2011 6:42 AM