Open pkgw opened 7 years ago
Update: Poppler is gone!
Usage includes:
pdfimage.cpp
: PDFDoc.h, Stream.h, Catalog.hXeTeX_ext.c
: poppler-config.hSo it's really all about embedding PDFs as images within other PDFs. All pdfimage.cpp
does is parse the document ("all") and get the bounds of a specified page, or count the pages.
I think (not sure though) xdvipdfmx has code to extract the bounding box of PDF files (among other image files) AKA the extractbb mode.
Indeed, it can read the bounding box and the number of pages:
$ extractbb -O -p5 sile.pdf
%%Title: sile.pdf
%%Creator: extractbb 20160307
%%BoundingBox: 0 0 595 842
%%HiResBoundingBox: 0.000000 0.000000 595.280000 841.890000
%%PDFVersion: 1.5
%%Pages: 78
%%CreationDate: Sun Apr 23 16:15:38 2017
And yes, it was just an hour's work to remove Poppler as a dependency! This is great, since Poppler is/was quite heavyweight.
Libpng is only used directly in dpx-pngimage.c
, which of course is all about reading PNG files to get their bounding boxes and embed them in PDF output files.
Crates.io shows a popular PNG crate. Unclear if it would have all of the bells and whistles that are exploited in the current xdvipdfmx code. Strangely there isn't obviously a Rust libpng-sys
crate ... you'd think there would be? Maybe PNGs are too simple for everyone.
Urgency: unclear. Libpng is popular, but its binary compatibility seems unreliable.
Things like libpng or whatever equivalent you settle on can safely be optional, too—not everyone needs images in their documents.
@chris-morgan Yup! The hope is that one day they will all be Cargo "features" that can be activated or deactivated as circumstances dictate. It will take a lot of infrastructure work to get to the point where that is possible, though.
We want Tectonic to depend on as few system libraries as we can get away with. This issue is for tracking the big picture of the overall project to reduce our dependence on system libraries.
The current roster of
pkg-config
dependencies is:Other libraries that the executable ends up depending on (on Linux):
(This is looking at
DT_NEEDED
records in the executable;ldd
walks the tree of deps and comes up with more.)We can probably eventually get rid of many of these!