GitHub - OpenPrinting/ghostscript-printer-app: Ghostscript Printer Application (original) (raw)

Ghostscript Printer Application

INTRODUCTION

This repository contains a Printer Application for printers supported by Ghostscript's built-in printer drivers and some extra filters.

It uses PAPPL to support IPP printing from multiple operating systems. In addition, it uses the resources of cups-filters 2.x (filter functions in libcupsfilters, libppd) andpappl-retrofit(encapsulating classic CUPS drivers in Printer Applications). This work (or now the code of pappl-retrofit) is derived from thehp-printer-app.

For printer capability and driver usage information the Foomatic database of OpenPrinting (Online access by printer, by driver,Downlod) is used.

Your contributions are welcome. Please post issues and pull requests.

Contained Printer Drivers (in the Snap)

ap3250, appledmp, bj10e, bj10vh, bj10v, bj10, bj200, bj8XXYYZ.upp,  
bjc250gs, bjc600, bjc800, bjc880j, cdj500, cdj550, cdnj500, chp2200,  
cljet5, cp50, declj250, deskjet, dj505j, djet500, dnj650c,  
eplaser-jp, eplaser, eps9high, eps9mid, epsonc, epson, escpage,  
fmlbp, fmpr, gdi, hl1250, hl7x0, ibmpro, imagen, iwhi, jetp3852,  
jj100, la50, la70, la75plus, la75, laserjet, lbp310, lbp320, lbp8,  
lex5700, lex7000, lips2p, lips3, lips4v, lips4, lj250, lj4dithp,  
lj4dith, lj5gray, ljet2p, ljet3d, ljet3, ljet4d, ljet4, ljetplus,  
ln03, lp2000, lp2563, lp8000, lq850, lxm3200-tweaked, lxm5700m,  
m8510, md1xMono, md2k, md50Eco, md50Mono, md5k, mj700v2c, ml600,  
necp2xX.upp, necp6, npdl, oce9050, oki182, oki4w, okiibm, paintjet,  
pcl3, picty180, pjetxl, pjxl300, pjxl, pj, ps2write, pr150, pr201,  
pxlcolor, pxldpl, pxlmono, r4081, rpdl, sharp.upp, sipixa6.upp,  
sj48, stcolor, t4693dX, tek4696, xes  

This gives support for many old and ancient printers, but also for PCL lasers (especially PCL 6/XL) and dot-matrix printers.
The included Ghostscript can have more drivers but these are the ones for which we have PPD support from Foomatic and which are not considered deprecated by another driver.

Not included

Properties

To Do

THE SNAP

Installing and building

To just run and use this Printer Application, simply install it from the Snap Store:

sudo snap install --edge ghostscript-printer-app

Then follow the instructions below for setting it up.

To build the Snap by yourself, in the main directory of this repository run

This will download all needed packages and build the Ghostscript Printer Application. Note that PAPPL (upcoming 1.0) and cups-filters (upcoming 2.0) are pulled directly from their GIT repositories, as there are no appropriate releases yet. This can also lead to the fact that this Printer Application will suddenly not build any more.

To install the resulting Snap run

sudo snap install --dangerous ghostscript-printer-app_1.0_amd64.snap

Setting up

The Printer Application will automatically be started as a server daemon.

Enter the web interface

Use the web interface to add a printer. Supply a name, select the discovered printer, then select make and model. Also set the installed accessories, loaded media and the option defaults. Accessory configuration and option defaults can also offen get polled from the printer.

Then print PDF, PostScript, JPEG, Apple Raster, or PWG Raster files with

ghostscript-printer-app FILE

or print with CUPS, CUPS (and also cups-browsed) discover and treat the printers set up with this Printer Application as driverless IPP printers (IPP Everywhere and AirPrint).

See

ghostscript-printer-app --help

for more options.

Use the "-o log-level=debug" argument for verbose logging in your terminal window.

You can add files to /var/snap/ghostscript-printer-app/common/usb/for additional USB quirk rules. Edit the existing files only for quick tests, as they get replaced at every update of the Snap (to introduce new rules).

You can edit the/var/snap/ghostscript-printer-app/common/cups/snmp.conf file for configuring SNMP network printer discovery.

For the pnm2ppa driver you can edit the configuration file:

/var/snap/ghostscript-printer-app/common/pnm2ppa/pnm2ppa.conf

For the foo2zjs and m2300w drivers you can add color profiles in the appropriate subdirectories of

/var/snap/ghostscript-printer-app/common/foo2zjs/
/var/snap/ghostscript-printer-app/common/m2300w/

Automatic firmware loading by foo2zjs is not supported. If you have one of these HP printers which need it, use the HPLIP Printer Application and download HP's plugin (use the web interface of the HPLIP Printer Application for that).

All the changes mentioned her take effect with the next print job.

If you mess up any configuration file under/var/snap/ghostscript-printer-app/common/, simply delete it (or move it away) and restart the Snap to get it restored.

THE ROCK (OCI CONTAINER IMAGE)

Install from Docker Hub

Prerequisites

  1. Docker Installed: Ensure Docker is installed on your system. You can download it from the official Docker website.

Step-by-Step Guide

You can pull the ghostscript-printer-app Docker image from either the GitHub Container Registry or Docker Hub.

From GitHub Container Registry
To pull the image from the GitHub Container Registry, run the following command:

sudo docker pull ghcr.io/openprinting/ghostscript-printer-app:latest

To run the container after pulling the image from the GitHub Container Registry, use:

sudo docker run -d
--name ghostscript-printer-app
--network host
-e PORT=
ghcr.io/openprinting/ghostscript-printer-app:latest

From Docker Hub
Alternatively, you can pull the image from Docker Hub, by running:

sudo docker pull openprinting/ghostscript-printer-app

To run the container after pulling the image from Docker Hub, use:

sudo docker run -d
--name ghostscript-printer-app
--network host
-e PORT=
openprinting/ghostscript-printer-app:latest

Setting Up and Running gutenprint-printer-app locally

Prerequisites

Docker Installed: Ensure Docker is installed on your system. You can download it from the official Docker website or from the Snap Store:

Rockcraft: Rockcraft should be installed. You can install Rockcraft using the following command:

sudo snap install rockcraft --classic

Skopeo: Skopeo should be installed to compile *.rock files into Docker images. It comes bundled with Rockcraft, so no separate installation is required.

Step-by-Step Guide

Build ghostscript-printer-app rock

The first step is to build the Rock from the rockcraft.yaml. This image will contain all the configurations and dependencies required to run ghostscript-printer-app.

Open your terminal and navigate to the directory containing your rockcraft.yaml, then run the following command:

Compile to Docker Image

Once the rock is built, you need to compile docker image from it.

sudo rockcraft.skopeo --insecure-policy copy oci-archive: docker-daemon:ghostscript-printer-app:latest

Run the ghostscript-printer-app Docker Container

sudo docker run -d
--name ghostscript-printer-app
--network host
-e PORT=
ghostscript-printer-app:latest

Setting up

Enter the web interface

Use the web interface to add a printer. Supply a name, select the discovered printer, then select make and model. Also set the installed accessories, loaded media and the option defaults. If the printer is a PostScript printer, accessory configuration and option defaults can also often get polled from the printer.

Included Components

BUILDING WITHOUT PACKAGING OR INSTALLATION

You can also do a "quick-and-dirty" build without snapping and without needing to install PAPPL,cups-filters 2.x, andpappl-retrofit into your system. You need a directory with the latest GIT snapshot of PAPPL, the latest GIT snapshot of cups-filters, and the latest GIT snapshot of pappl-retrofit (master branches of each). They all need to be compiled (./autogen.sh; ./configure; make), installing not needed. Also install the header files of all needed libraries (installing "libcups2-dev" should do it).

In the directory with ghostscript-printer-app.c run the command line

gcc -o ghostscript-printer-app ghostscript-printer-app.c <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>P</mi><mi>A</mi><mi>P</mi><mi>P</mi><msub><mi>L</mi><mi>S</mi></msub><mi>R</mi><mi>C</mi><mi mathvariant="normal">/</mi><mi>p</mi><mi>a</mi><mi>p</mi><mi>p</mi><mi>l</mi><mi mathvariant="normal">/</mi><mi>l</mi><mi>i</mi><mi>b</mi><mi>p</mi><mi>a</mi><mi>p</mi><mi>p</mi><mi>l</mi><mi mathvariant="normal">.</mi><mi>a</mi></mrow><annotation encoding="application/x-tex">PAPPL_SRC/pappl/libpappl.a </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.13889em;">P</span><span class="mord mathnormal">A</span><span class="mord mathnormal" style="margin-right:0.13889em;">PP</span><span class="mord"><span class="mord mathnormal">L</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3283em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight" style="margin-right:0.05764em;">S</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathnormal" style="margin-right:0.07153em;">RC</span><span class="mord">/</span><span class="mord mathnormal">p</span><span class="mord mathnormal">a</span><span class="mord mathnormal" style="margin-right:0.01968em;">ppl</span><span class="mord">/</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord mathnormal">ib</span><span class="mord mathnormal">p</span><span class="mord mathnormal">a</span><span class="mord mathnormal" style="margin-right:0.01968em;">ppl</span><span class="mord">.</span><span class="mord mathnormal">a</span></span></span></span>CUPS_FILTERS_SRC/.libs/libppd.a <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>C</mi><mi>U</mi><mi>P</mi><msub><mi>S</mi><mi>F</mi></msub><mi>I</mi><mi>L</mi><mi>T</mi><mi>E</mi><mi>R</mi><msub><mi>S</mi><mi>S</mi></msub><mi>R</mi><mi>C</mi><mi mathvariant="normal">/</mi><mi mathvariant="normal">.</mi><mi>l</mi><mi>i</mi><mi>b</mi><mi>s</mi><mi mathvariant="normal">/</mi><mi>l</mi><mi>i</mi><mi>b</mi><mi>c</mi><mi>u</mi><mi>p</mi><mi>s</mi><mi>f</mi><mi>i</mi><mi>l</mi><mi>t</mi><mi>e</mi><mi>r</mi><mi>s</mi><mi mathvariant="normal">.</mi><mi>a</mi></mrow><annotation encoding="application/x-tex">CUPS_FILTERS_SRC/.libs/libcupsfilters.a </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.07153em;">C</span><span class="mord mathnormal" style="margin-right:0.10903em;">U</span><span class="mord mathnormal" style="margin-right:0.13889em;">P</span><span class="mord"><span class="mord mathnormal" style="margin-right:0.05764em;">S</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3283em;"><span style="top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight" style="margin-right:0.13889em;">F</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathnormal" style="margin-right:0.07847em;">I</span><span class="mord mathnormal">L</span><span class="mord mathnormal" style="margin-right:0.00773em;">TER</span><span class="mord"><span class="mord mathnormal" style="margin-right:0.05764em;">S</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3283em;"><span style="top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight" style="margin-right:0.05764em;">S</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathnormal" style="margin-right:0.07153em;">RC</span><span class="mord">/.</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord mathnormal">ib</span><span class="mord mathnormal">s</span><span class="mord">/</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord mathnormal">ib</span><span class="mord mathnormal">c</span><span class="mord mathnormal">u</span><span class="mord mathnormal">p</span><span class="mord mathnormal">s</span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mord mathnormal">i</span><span class="mord mathnormal">lt</span><span class="mord mathnormal">ers</span><span class="mord">.</span><span class="mord mathnormal">a</span></span></span></span>PAPPL_RETROFIT_SRC/.libs/libpappl-retrofit.a -ldl -lpthread  -lppd -lcups -lavahi-common -lavahi-client -lgnutls -ljpeg -lpng16 -ltiff -lz -lm -lusb-1.0 -lpam -lqpdf -lstdc++ -I. -I$PAPPL_SRC/pappl -I$CUPS_FILTERS_SRC/ppd -I$CUPS_FILTERS_SRC/cupsfilters -I$PAPPL_RETROFIT_SRC/pappl/retrofit -L$CUPS_FILTERS_SRC/.libs/ -L$PAPPL_RETROFIT_SRC/.libs/

There is also a Makefile, but this needs PAPPL, cups-filters 2.x, and pappl-retrofit to be installed into your system.

Run

./ghostscript-printer-app --help

When running the non-snapped version, by default, PPD files are searched for in

/usr/share/ppd/
/usr/lib/cups/driver/
/var/lib/ghostscript-printer-app/ppd/

You can set the PPD_PATHS environment variable to search other places instead:

PPD_PATHS=/path/to/my/ppds:/my/second/place ./ghostscript-printer-app server

Simply put a colon-separated list of any amount of paths into the variable. Creating a wrapper script is recommended.

This Printer Application uses CUPS' backends and not PAPPL's, meaning that for USB printers CUPS' USB quirk workarounds for compatibility problems are used, network printers can also be used with IPP, IPPS, and LPD protocols, and SNMP printer discovery is configurable.

USB Quirk rules in /usr/share/cups/usb and the /etc/cups/snmp.conffile can get edited if needed.

Make sure you have Ghostscript, CUPS (at least its backends), and the desired printer drivers (if not built into Ghostscript) installed.

For access to the test page testpage.ps use the TESTPAGE_DIR environment variable:

TESTPAGE_DIR=`pwd` PPD_PATHS=/path/to/my/ppds:/my/second/place ./ghostscript-printer-app server

or for your own creation of a test page (PostScript, PDF, PNG, JPEG, Apple Raster, PWG Raster):

TESTPAGE=/path/to/my/testpage/my_testpage.ps PPD_PATHS=/path/to/my/ppds:/my/second/place ./ghostscript-printer-app server

The Ghostcript Printer Application is Copyright © 2020 by Till Kamppeter.

It is derived from the HP PCL Printer Application, a first working model of a raster Printer Application using PAPPL. It is available here:

https://github.com/michaelrsweet/hp-printer-app

The HP PCL Printer Application is Copyright © 2019-2020 by Michael R Sweet.

This software is licensed under the Apache License Version 2.0 with an exception to allow linking against GPL2/LGPL2 software (like older versions of CUPS). See the files "LICENSE" and "NOTICE" for more information.