2

I have UPS generated label with ZPL which I want to print. I can do it via printer driver but it is not convinient.

I could generate GIF file but after resizing to 4x8 inches it looses quality.

Is there a way to convert ZPL file into common graphic format so I can just open and print from a file ? Preferably in PHP.

3 Answers 3

3

If you don't want to send your data to a cloud service you can have a look at our project we have developed an open ZPL viewer that converts ZPL data into a graphic. The project is based on .NET.

More Informations are available here BinaryKits.Zpl.Viewer (GitHub)

You can start your own docker container. The project contains a WebApi with a Swagger interface.

Sign up to request clarification or add additional context in comments.

Comments

2

If it's just one / some labels, you can try to use http://labelary.com/, they convert ZPL online to image files.

UPS does offer GIF labels in different formats though, so it should be possible for you to request the right format and convert it without quality loss.

If you're looking for an easier way to deal with label filetypes, you may want to explore Shippo. Shippo offers a PHP client library and you can easily change label file types (PNG, ZPL, PDF) on a per-request basis via a RESTful API.

3 Comments

Thank for the tips. I know labelary.com, unfortunately they offer only online services via API, and for privacy reasons I cannot send client data. I also asked for offline library but didn't get any answer from them yet. I read UPS API documentation, but couldn't found PNG/PDF option for generating label. Only GIF, ZPL, EPL, STARPL. PDF is only for iternational service. Can I use it as regular package ?
My apologies - yes, you're right UPS only offers GIF/ZPL/EPL, not PDF directly. The PDF is provided by Shippo, that's why I initially thought it came from UPS directly (editing my answer now). You should be able to get the correct GIF from UPS without having to resize it though, allowing you to convert it to PDF without any quality loss.
For Zebra Thermal Printers I have to resize that GIF, because it is too large. Unfortunately I cannot specify width and height from API level for GIF format.
2

If you want to print ZPL so that it comes out as a formatted label, install your printer as a Generic, Text Based printer driver. Then, when you have ZPL in notepad or something, and print to the printer, it will send the ZPL commands, the printer will interpret them, and will print the label as expected.

1 Comment

Thank you, this worked perfectly, the printer interpret the ZPL code even printing from Chrome

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.