[poppler] Generating lovely pen plotter output from Poppler: Pull request

jonh.poppler at jonh.net jonh.poppler at jonh.net
Thu Dec 17 07:58:04 UTC 2020


Howdy team Poppler, 

I've been on a decades-long quest for the best way to get cool output
onto my 1985 HP 7585B pen plotter. There are dozens of tools for
generating HPGL from various formats around the Internet, and they all
stink. This tool is the HPGL conversion tool to end all HPGL conversion
tools -- a motto that rolls off the tongue! 

I'd greatly appreciate it if someone on the team could GUIDE ME THROUGH
GETTING THESE CHANGES INTO POPPLER. Below i give a brief description of
the changes, quick-start instructions to try it out, and specific
requests for feedback and guidance. 

Thank you! 

What's in the tin 

Please find my branch here: 

https://github.com/jonhnet/plotler 

It consists of: 

* A first commit that refactors SplashOutputDev to put a part of its
functionality into a weaker superclass VectorOutputDev. This is to
prepare for code sharing without "subclass-by-deletion". This commit
also exposes a couple of methods in SplashPath as public.  It also moves
some supporting code that used to be in SplashOutputDev into a pair of
new files VectorFonts and VectorDynamicPatters; just an overdue cleanup.
(4dec008eddea2329c0e8277398803cb9022b15cc) 

* Then the rest of plotler as new files: A new StrokeOutputDev that
inherits from VectorOutputDev to capture stroke and drawChar commands
and flatten them down to simple strokes. A new utils/plotler.cc CLI that
invokes it. It relies on: 

- Plot, PlotClip, and PlotEmit for manipulating pen paths. 

- HersheyFont, HersheyDirectory, and HersheyUnicodeSubstitutions for
manipulating Hershey fonts. 

Try it out 

# standard poppler build
git clone https://github.com/jonhnet/plotler
mkdir poppler-install
cd plotler
mkdir build; cd build;
INSTALLDIR=`(cd ../../poppler-install; pwd)`
cmake .. -DCMAKE_INSTALL_PREFIX=$INSTALLDIR -DCMAKE_BUILD_TYPE=debugfull
make -j4
make install 

# and now try plotler
./utils/plotler -i ../test/plotler/brake-diagram.pdf -o proof.svg && eog
proof.svg
./utils/plotler -i ../test/plotler/verikv-osdi2020-final.pdf -n 9 -o
proof2.svg && eog proof2.svg 

Feedback requested 

- Community code standards. Guidance welcome. 

- I have written zero tests. Guidance on meeting appropriate standards
would be helpful. 

- My commit includes a bunch of PDF test files I used to guide
development. Should these be removed or included in the proposed change?


- Utility name. Plotler maybe is too clever? I considered "pdftohpgl",
but the thing can already emit SVG, and I could imagine growth to
support more formats. 

Background 

After finding other tools wanting, I wrote my own Python SVG->HPGL
extension a decade ago. It sucked, because it required me to interpret
so much of SVG. Then I thought, hey, I_nkscape_ knows how to interpret
SVG! So I hacked a converter into inkscape 0.42 -- and it served me well
for years, long after modern distros couldn't build that version of
Inkscape. But it wasn't super flexible, and there was no reasonable way
to share it. A couple years ago I thought, maybe it's time to try again
with a general vector graphics engine designed for library access, so I
sat down with Ghostscript. I aged three years that weekend. 

It finally struck me that I should find a _modern_ vector graphics
toolkit. And if I start with PDF, I'm basically building a printer
driver. Poppler was the perfect fit -- nicely organized & modularized
code, and already set up to build a set of conversion utilities, so
plotler fits right in. 

I think it would be fun to write a CUPS backend based on Plotler, so I
can just click "Print" in any application and have it pop out on a pen
plotter.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/poppler/attachments/20201216/d86112b1/attachment.htm>


More information about the poppler mailing list