1
votes

I have developed an application in C# which prints image to my zebra printer.

My zebra print is Zebra printer 104S version. When ever i am printing the image to my printer its takes a longer time to print the image and the image is starting from the little bit below of the label.

What i am trying to ask is how can i send my converted GRF image to printer. Where i need to print fast and i need to flush the memory of my zebra printer each time i print a new image. How can i do this.

Code snippet:

private void print_Click(object sender, EventArgs e)
{
    string s = image_print() + Print_image();
    PrintFactory.sendTextToLPT1(s);
    /*string Filename = img_path.Text;
    MessageBox.Show("file", Filename);
    // if (Filename.ToCharArray().Intersect(Path.GetInvalidFileNameChars()).Any())
    //   return;
    File.Delete(Path.Combine(@"E:\Debug", Filename));*/
}

private string image_print()
{
    OpenFileDialog ofd = new OpenFileDialog();
    string path = "";
    string full_path = "";
    string filename_noext = "";
    ofd.InitialDirectory = @"C:\ZTOOLS\FONTS";
    ofd.Filter = "GRF files (*.grf)|*.grf";
    ofd.FilterIndex = 2;
    ofd.RestoreDirectory = true;

    if (ofd.ShowDialog() == DialogResult.OK)
    {
        filename_noext = System.IO.Path.GetFileName(ofd.FileName);
        path = Path.GetFullPath(ofd.FileName);
        img_path.Text = filename_noext;
        //MessageBox.Show(filename_noext, "Filename");
        // MessageBox.Show(full_path, "path");
        //move file from location to debug
        string replacepath = @"E:\Debug";
        string fileName = System.IO.Path.GetFileName(path);
        string newpath = System.IO.Path.Combine(replacepath, fileName);
        if (!System.IO.File.Exists(filename_noext))
            System.IO.File.Copy(path, newpath);

    }
    StreamReader test2 = new StreamReader(img_path.Text);
    string s = test2.ReadToEnd();
    return s;
}

private string Print_image()
{
    //^XA^WDE:*.GRF^FS^XZ
        string s = "";
        s += "^XA^LH" + "" + "," + "" + "^FO0,0^XGR" + img_path.Text + ".GRF,1,1^FS";
        s += "^FO184,155^A0N,47,36^FD" + "" + "^FS";
        s += "^FO250,235^AFN,33,0^FD" + "" + "^FS";
        s += "^FO500,561^A0N,24,19^FD" + "" + "^FS";
        s += "^XZ";
        return s;
}
1

1 Answers

0
votes

Save the image to EEPROM on the printer and call the image by name. This is only viable if you are using it only once. If you are constantly generating a new different image, then you are reliant on the transfer medium.