Part-DB / Part-DB-server

Part-DB is an Open source inventory management system for your electronic components
https://docs.part-db.de/
GNU Affero General Public License v3.0
922 stars 105 forks source link

ZPL/EPL Support for direct label printing. #489

Open fiz-o-matic opened 9 months ago

fiz-o-matic commented 9 months ago

Hi,

It's possible to add the capability to print labels direct to a label printer via ZPL or EPL? Many professional label printer use a special language to print direct a label from the application without a print server. Brother and Zebra printer supporting ZPL and EPL to print a labels.

Thanks!

jbtronics commented 9 months ago

Part-DB runs in a browser and must be able to communicate with the printer directly. the normal browser APIs dont support that, so you most likely require a browser plugin or companion app to do that.

The bigger problem is that Part-DB labels are HTML, which are rendered into PDF. It seems that ZPL is pretty limited in terms of text formatting compared to HTML/PDF. So you cannot really convert the labels into ZPL, without big changes. I think the best possible, would be to convert the labels into an image and then let the printer print that image on the labels.

I would assume that label printers should have some kind of printer driver, which allows them to print arbitary stuff via the windows printer subsystem. And in this case you can print the labels from Part-DB from inside the browser with the print dialog of windows/your browser.

fiz-o-matic commented 9 months ago

ZPL is designed to print the label directly from the application or from the server. So you don't need a special driver or a special subsystem for printing.

I think there are some php libraries to communicate with a printer directly over ethernet (or USB).

At the moment I have to download the generated PDF and print it over CUPS. On my OSX I can't print directly from the page because I can't see anything in the preview window.

jaimelaborda commented 8 months ago

I also love this. I'm currently planning on doing some application/plugin that interfaces with PartsDB API to get the label data. But it will awesome to have this natively inside PartDB. Sadly I don't know nothing about web programming neither PHP.

whc2001 commented 6 months ago

I also need something like this. The printer I use only supports TSPL over USB. My old solution with PartKeepr was to made a local application to packet capture the browser requests, on each new part submission it grabs some of the information and construct the TSPL script by hand then send to the printer raw device. I wonder if the same could work for Part-DB...

EDIT: This won't work as Part-DB respond a PHP page instead of serialized data. This makes parsing very hard. I am considering only capturing the request and use API to get the information. Huge refactor though.