https://github.com/attah/ppm2pwg
Misc printing utilities
https://github.com/attah/ppm2pwg
ipp ipp-protocol jpeg pdf postscript printing pwg pwg-raster urf
Last synced: 27 days ago
JSON representation
Misc printing utilities
- Host: GitHub
- URL: https://github.com/attah/ppm2pwg
- Owner: attah
- License: gpl-3.0
- Created: 2020-01-20T20:33:57.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2026-03-25T21:06:58.000Z (2 months ago)
- Last Synced: 2026-03-26T20:21:16.879Z (2 months ago)
- Topics: ipp, ipp-protocol, jpeg, pdf, postscript, printing, pwg, pwg-raster, urf
- Language: C++
- Homepage:
- Size: 461 KB
- Stars: 23
- Watchers: 2
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# ppm2pwg - misc printing utilities
(should really be renamed)
[](https://github.com/attah/ppm2pwg/actions/workflows/unit-test.yml)
[](https://github.com/attah/ppm2pwg/actions/workflows/clang-tidy.yml)
[](https://github.com/attah/ppm2pwg/actions/workflows/codeql-analysis.yml)
[](https://webchat.oftc.net/?channels=ppm2pwg)
Available as rudimentary standalone applications, but mainly made for use in [SeaPrint](https://github.com/attah/harbour-seaprint).
## ppm2pwg
Takes a pbm, pgm or ppm (P4, P5 or P6 "raw") Netpbm bitmap image and converts to PWG or URF printer raster format. Supports 1, 8 and **16** bits per color.
## pwg2ppm
For debugging. Similar to [rasterview](https://github.com/michaelrsweet/rasterview), but without a GUI. Takes a PWG or URF printer raster and outputs a series of P4, P5 or P6 pbm/pgm/ppm images.
## pdf2printable
Takes a PDF document and makes it suitable for printing, by:
- rotate and scale to fit as needed to a desired page size
- convert to PDF 1.7¹, Postscript level 2 or PWG/URF raster
1. PDF 1.5 if using Cairo < 1.17.6.
## baselinify
Takes a JPEG and losslessly repacks it to the baseline ecoding profile, keeping only JFIF and Exif headers.
Sort of like jpegtran without any arguments.
IPP-printers are only required to support baseline-encoded jpeg according to PWG5100.14.
Despite working with in-memory data, it only requires the libjpeg 62.2.0 and not 62.3.0/7.3+ API, so it works on conservative distros.
## ippclient
An IPP client that harnesses the above tools for converting files to be printed.
This is a port/rewrite/clean-up of the core parts of SeaPrint in regular (non-Qt) C++.
The plan is to swap over to using this once fature parity is achieved.
## ippdiscover
A DNS-SD/mDNS "simple resolver" which looks for ipp and ipps printers on the local network.
## Building
Install dependencies:
`sudo apt install libpoppler-dev libpoppler-glib-dev libcairo2-dev libglib2.0-dev libjpeg-dev libcurl4-openssl-dev zlib1g-dev`
These are the aggregate dependencies; **ippclient** needs all of them and e.g. **ppm2pwg** needs none of them.
Build:
`make -j$(nproc)`
## pdf2printable vs the competition
(As of 2025-12-13)
A bit of friendly comparison helps make sure the featureset is well-rounded and performance is on par.
### Basics
| | PDF renderer | Language | License |
| ------------------------------------------------------- | --------------------- | ----------- | ------------------ |
| pdf2printable | Poppler¹ | C++ | GPL3 |
| [ipptransform](https://github.com/OpenPrinting/libcups) | XPDF or Poppler¹ | C | Apache 2.0 |
| [ghostscript](https://ghostscript.com/)² | Ghostscript | C | AGPL or commercial |
| [mutool](https://mupdf.com/) | MuPDF | C | AGPL or commercial |
| [jrender](https://github.com/HPInc/jipp) | Apache PDFBox | Java/Kotlin | MIT |
Not in the running: Android/Apple built-ins and Google Cloud Print (not available standalone).
Ghostscript is standing in for cups-filters, since that's what is used under the hood.
1. pdf2printable uses the Cairo backend in Poppler and ipptransform uses the Splash backend inhertited from XPDF. Cairo generally produces higher quality rasterization, but is slightly more prone to misrendering with unusual PDFs.
2. Not freshly built from source.
### Format support
| | PDF | Postscript | PWG | URF | PCLm¹ | PCL² |
| ------------- | --- | ---------- | --- | --- | ---------- | --------- |
| pdf2printable | ✔ | ✔ | ✔ | ✔ | ✘ | ✘ |
| ipptransform | ✔ | ✔ | ✔ | ✔ | ✔ | ✔³ |
| ghostscript | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
| mutool | ✔ | ✘ | ✔ | ✘ | ✔ | ✔ |
| jrender | ✘ | ✘ | ✔ | ✘ | ✔ | ✘ |
Good printers should support PDF or PWG. After that, URF is the biggest enabler.
1. I have not yet seen a printer support PCLm and none of the other formats that pdf2printable supports.
2. PCL comes in many different dialects (even beyond the versions) so it might not work across all printers.
3. Pre-rasterized compatibility version.
### Features
| | back-xform¹ | color modes ²| rotate-to-fit | page selection | stdout |
| ------------- | ---------------- | ----------------- | ------------- | -------------- | --------- |
| pdf2printable | ✔ | ✔(6) | ✔ | ✔ | ✔(+stdin) |
| ipptransform | ✔ | ✔(5) | ✔ | ✔ | ✔ |
| ghostscript | ? | ✔(6+) | ✘ | ✔ | ✔(+stdin) |
| mutool | ✘ | ✔(4) | ✘ | ✔ | ✘ |
| jrender | ✘ | ✘(1)³ | ✘ | ✘ | ✘ |
1. PWG, URF and PCLm printers may require the client to help transform backside pages for duplex printing, or they will come out incorrectly.
2. Two color modes (sRGB24 and sGray8) is enough for basically anything.
3. Jrender can be patched to do gray or bi-level, but the output is broken.
### Performance
Measured with a representative 90-page document for PWG-raster at 600 DPI on a AMD 3950X.
| | Speed (RGB) | Speed (Gray) | Size (RGB) | Size (Gray) |
| ---------------------- | ----------- | -------------| ------------ | ----------- |
| pdf2printable | 500 PPM | 529 PPM | 152 MB | 76 MB |
| ipptransform | 198 PPM | 186 PPM | 159 MB | 76 MB |
| ghostscript | 575 PPM | 643 PPM | 152 MB | 76 MB |
| mutool (AA off) | 264 PPM | 188 PPM | 153 MB | 76 MB |
| jrender (600dpi patch) | 167 PPM | N/A | 334 MB¹ | N/A |
1. Antialiasing seems to be enabled and would account for the size difference. However, at these resolutions that doesn't really provide much benefit. For pdf2printable, ghostscript and mutool it can be optionally enabled/disabled.
pdf2printable will match or beat ghostscript if compield with `-mtune=native`, but that would be cheating, as ghostscript surely would retake the lead if allowed architecture-dependent optimizations too.