Printing UPS ZPL标签尺寸问题我需要ZP450打印机的小尺寸标签

Printing UPS ZPL标签尺寸问题我需要ZP450打印机的小尺寸标签,printing,size,label,ups,Printing,Size,Label,Ups,我想以以下尺寸显示UPS标签尺寸宽度=4英寸,高度=8英寸 但是当我在我的浏览器上显示GraphicImage时,UPS API会以base64格式返回它 它在我的浏览器上显示非常大的图像,如宽度:1400px,高度:800px 当我在我的ZP450打印机上打印这个图像时,它在页面上打印了非常小的图像,即使页面上不可读 非常感谢任何帮助,我如何在浏览器上显示小级别图像 或者直接使用base64代码发送打印,但我想在像UPS.COM printed这样的页面上打印大尺寸的图像。在使用ZPL格式将

我想以以下尺寸显示UPS标签尺寸宽度=4英寸,高度=8英寸

但是当我在我的浏览器上显示GraphicImage时,UPS API会以base64格式返回它

它在我的浏览器上显示非常大的图像,如宽度:1400px,高度:800px

当我在我的ZP450打印机上打印这个图像时,它在页面上打印了非常小的图像,即使页面上不可读

非常感谢任何帮助,我如何在浏览器上显示小级别图像


或者直接使用base64代码发送打印,但我想在像UPS.COM printed这样的页面上打印大尺寸的图像。

在使用ZPL格式将UPS GraphicImage标签发送到Zebra打印机之前,您需要将其从base64字符串转换为ascii字符串。看到答案了吗

ZPL标签应使用通用文本打印机驱动程序作为原始打印。您可以使用记事本编辑和打印标签,只要关闭其换行、页边距、页眉/页脚/页码设置。记事本++可以工作


我认为UPS EPL格式的标签也是如此。

在新版本的API中,它们没有
标签规范
对象,因此此解决方案可能会对您有所帮助。这些设置对热敏打印机有帮助:

shipment.Documents = new DocumentsType();
shipment.Documents.Image = new ImageType[1];
shipment.Documents.Image[0] = new ImageType();
shipment.Documents.Image[0].Type = new ShipCodeDescriptionType();
shipment.Documents.Image[0].Type.Code = "30";
shipment.Documents.Image[0].PrintFormat = new ShipCodeDescriptionType();
shipment.Documents.Image[0].PrintFormat.Code = "02"; // thermal
shipment.Documents.Image[0].Format = new ShipCodeDescriptionType();
shipment.Documents.Image[0].Format.Code = "01"; // pdf
shipment.Documents.Image[0].LabelsPerPage = "1";
shipment.Documents.Image[0].PrintSize = new PrintSizeType();
shipment.Documents.Image[0].PrintSize.Length = "4";
shipment.Documents.Image[0].PrintSize.Width = "6";
从上面的代码中,您可以看到,因为他们接受一个用于图像设置的数组,这意味着它应该返回多个具有不同规格的图像

这就是我如何转换返回的标签图像并将其保存到服务器上的方法:

if (!string.IsNullOrEmpty(base64) && !string.IsNullOrEmpty(extension))
{
    byte[] bytes = Convert.FromBase64String(base64);

    var path = "~/ShippingLabels/UPS";

    if (!Directory.Exists(Server.MapPath(path)))
    {
        Directory.CreateDirectory(Server.MapPath(path));
    }

    var filePath = string.Format("{0}/{1}_{2}_{3}.{4}", path, freightShipResponse.ShipmentResults.BOLID, freightShipResponse.ShipmentResults.ShipmentNumber, DateTime.Now.ToString("yyyyMMddmmhhssfff"), extension);

    System.IO.FileStream stream = new FileStream(Server.MapPath(filePath), FileMode.CreateNew);
    System.IO.BinaryWriter writer = new BinaryWriter(stream);
    writer.Write(bytes, 0, bytes.Length);
    writer.Close();
}

你有没有找到解决这个问题的办法?
if (!string.IsNullOrEmpty(base64) && !string.IsNullOrEmpty(extension))
{
    byte[] bytes = Convert.FromBase64String(base64);

    var path = "~/ShippingLabels/UPS";

    if (!Directory.Exists(Server.MapPath(path)))
    {
        Directory.CreateDirectory(Server.MapPath(path));
    }

    var filePath = string.Format("{0}/{1}_{2}_{3}.{4}", path, freightShipResponse.ShipmentResults.BOLID, freightShipResponse.ShipmentResults.ShipmentNumber, DateTime.Now.ToString("yyyyMMddmmhhssfff"), extension);

    System.IO.FileStream stream = new FileStream(Server.MapPath(filePath), FileMode.CreateNew);
    System.IO.BinaryWriter writer = new BinaryWriter(stream);
    writer.Write(bytes, 0, bytes.Length);
    writer.Close();
}