OpenPrinting / ps-printer-app

PostScript Printer Application
Apache License 2.0
37 stars 13 forks source link

How to make it working with thermal printer #17

Closed drcoccodrillus closed 1 year ago

drcoccodrillus commented 1 year ago

I am trying to make this snap working on Ubuntu Core with Custom thermal printers which are provided by the manufacturer with their own PPD files as well as CUPS filters. Now I wonder if there is any chance to make this snap working with this kind of printers. This is the printer model I am working on right now: https://www.custom4u.it/pages/product/index.php From the Driver tab it is possible to download a tar archive containing CUPS driver.

tillkamppeter commented 1 year ago

The PostScript Printer Applications is intended for PostScript printers, where the driver is just a PPD file. Then you can upload the PPD file into the Printer Application if it is not already included.

If your PPD file contains a *cupsfilter(2): ... line specifying a filter executable, the PostScript Printer Application cannot be used for it. For security reasons, none of the Printer Application Snaps allows uploading binary executables into them.

If you want to have your driver in a Snap, you could create your own based on pappl-retrofit with one or another of the existing Printer Application Snaps as a sample.

If it is only about to install your driver into a Printer Application so that you can use it with the CUPS Snap or be prepared to use it with CUPS 3.x, get pappl-retrofit and install its Legacy Printer Application. This Printer Application sees all normally installed CUPS drivers on a system and provides them as Printer Application.

drcoccodrillus commented 1 year ago

All good, I am looking into it right now. However, for my understanding, installing pappl-retrofit is useful in a system where coexist a "classically installed CUPS with classically installed drivers" (https://openprinting.github.io/OpenPrinting-News-November-2021/#your-driver-not-in-a-printer-application---the-legacy-printer-application) and the snapped version of CUPS. Now, this is not a viable option for Ubuntu Core because it's not possible to install pappl-retrofit on it.

tillkamppeter commented 1 year ago

If you are on Ubuntu Core, (sorry, I perhaps overlooked it in the first place) you are on an all-Snap distro, so whatever software you install must exist in Snap format. This would mean that you have to create a Snap of your driver, based on pappl-retrofit (you do not need to install pappl-retrofit on your system to do so), and once having done so, you can install the Snap on your Ubuntu Core system.

tillkamppeter commented 1 year ago

To create such a Snap you can take the source code of the PostScript Printer Application as an example. You need, via a part in snapcraft.yaml add your driver's CUPS filter(s) to the Snap, and add your PPDs to it. You can remove the PostScript PPDs from the Snap. And you should give the Snap another name, like thermal-printer-app.

drcoccodrillus commented 1 year ago

I'm sorry for involuntary closing the issue, shame on me... That's right, working with Ubuntu Core puts some fun in the game :) Thank you for pointing me out the way :)

drcoccodrillus commented 1 year ago

With a bit of refactoring I've got a yaml that builds a snap with PPD and filter files of my thermal printers. However when I try to add the printer through the web interface I get this error message: "Unable to use that driver". I've put CUPS filters in this folder: usr/lib/thermal-printer-app/filter/ and PPD files in this one: usr/share/ppd/ Is there anything I'm not considering in order to make it works?

tillkamppeter commented 1 year ago

Could you make your work available to us? The snapcraft.yaml and also any additional files you created?

drcoccodrillus commented 1 year ago

This is the yaml I am working on snapcraft.zip I just removed a couple of things from the original one and copied PPD and filter in the directories I mentioned in the previous comment. In the same zip archive there are also PPD and raster files.