I am currently printing on a Zebra printer, and it prints the label normally from ZPL, but if I add an image to the ZPL code, it does not print anything, I add the image from ZPL with the add image option, any solution? Thanks:)
Code without image:
^XA
^FX Third section with bar code.
^BY5,2,270
^FO100,250^BC^FD12345678^FS
^FX Fourth section (the two boxes on the bottom).
^FO60,600^GB700,200,3^FS
^CF0,40
^FO150,650^FDREFERENCIA:ASDFGHJK211 ^FS
^FO300,710^FDTALLA:32 ^FS
^XZ
With image:
^XA
^FX Third section with bar code.
^BY5,2,270
^FO100,250^BC^FD12345678^FS
^FX Fourth section (the two boxes on the bottom).
^FO60,600^GB700,200,3^FS
^CF0,40
^FO150,650^FDREFERENCIA:ASDFGHJK211 ^FS
^FO300,710^FDTALLA:32 ^FS
^XZ
I use a class RawPrinterHelper.
using System;
using System.Drawing.Printing;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
using static RawPrinterHelper;
namespace a
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string s = "^XA^FO50,50^XGc:a.GRF^FS^XZ ";
PrintDialog pd = new PrintDialog();
pd.PrinterSettings = new PrinterSettings();
if (DialogResult.OK == pd.ShowDialog(this))
{
//CODIGO CORRECTO ABAJO
//^ XA ^ FO ^ FO300,20 ^ C:2033.PNG Third section with bar code.^ BY5,2,270 ^ FO100,250 ^ BC ^ FD12345678 ^ FS ^ FX Fourth section(the two boxes on the bottom).^ FO60,600 ^ GB700,200,3 ^ FS ^ CF0,40 ^ FO150,650 ^ FDREFERENCIA:ASDFGHJK211 ^ FS ^ FO300,710 ^ FDTALLA:32 ^ FS ^ XZ
//---------------------------------//Imagen
//^ XA ^ FO20,20 ^ XGR:2033.PNG ^ XZ
RawPrinterHelper.SendStringToPrinter(pd.PrinterSettings.PrinterName, s);
}
}
public static bool SendTextFileToPrinter(string szFileName, string printerName)
{
var sb = new StringBuilder();
using (var sr = new StreamReader(szFileName, Encoding.Default))
{
while (!sr.EndOfStream)
{
sb.AppendLine(sr.ReadLine());
}
}
return RawPrinterHelper.SendStringToPrinter(printerName, sb.ToString());
}