74 lines
4.2 KiB
Markdown
74 lines
4.2 KiB
Markdown
# Extended synthetic PDF corpus
|
|
|
|
These five original documents contain nine pages. Their drawing source and
|
|
explicit expected geometry are in `../extended_generator.py` and `manifest.json`.
|
|
They are reproducible test fixtures, not approved golden images.
|
|
|
|
| Document | Pages | Covered content |
|
|
| --- | ---: | --- |
|
|
| japanese-layout.pdf | 2 | Embedded Japanese TrueType subset, horizontal text, explicit ruby coordinates, vertical glyph positions, text matrices at 0/90/180/270 degrees |
|
|
| graphics-compositing.pdf | 1 | Original RGB and RGBA images, soft mask, 50% vector transparency and overlap, circular clipping, axial shading, CMYK swatches |
|
|
| page-geometry.pdf | 4 | Different MediaBox dimensions, offset CropBox, Rotate values 0/90/270/180, four known color markers per page |
|
|
| unembedded-font.pdf | 1 | Standard-14 Helvetica, Times-Roman and Courier substitution baseline |
|
|
| icc-linear-rgb.pdf | 1 | Embedded linear-sRGB matrix/TRC profile in ICCBased vector and raster colors, plus identical DeviceRGB control values |
|
|
|
|
The Japanese text uses BIZ UDPGothic Regular. The font is subset-embedded, and
|
|
its SIL Open Font License 1.1 is included in `FONT-OFL.txt`. The font file hash
|
|
and upstream license URL are recorded in the manifest. The full font file is
|
|
not redistributed here. The license permits embedding and redistribution;
|
|
these documents do not modify the original font's reserved name.
|
|
|
|
Generate with Python containing ReportLab, pypdf and Pillow:
|
|
|
|
```sh
|
|
python3 tests/fixtures/pdf/extended_generator.py
|
|
```
|
|
|
|
The default font location is
|
|
`/usr/local/share/fonts/BIZ_UDPGothic/BIZUDPGothic-Regular.ttf`.
|
|
Set `DOCVIEW_JAPANESE_FONT` to another installation of that font with its adjacent
|
|
`OFL.txt` when necessary. A changed font file changes the fixture hashes.
|
|
|
|
After building DocView's `pdf-worker-evidence` target and installing Poppler command-line tools:
|
|
|
|
```sh
|
|
python3 tests/compare_pdf_extended.py
|
|
```
|
|
|
|
The comparison generates full-resolution PNGs, difference images, contact sheets,
|
|
text extraction and a machine-readable report under `tests/results/pdf-extended`.
|
|
It assembles pages from the production sandboxed PDF worker's 512-pixel tiles, using FontBroker for unembedded fonts, and
|
|
compares them with independently rendered Poppler pages at 144 dpi. CropBox and
|
|
Rotate are honored. Deterministic size, marker, alpha and Japanese text/search
|
|
assertion failures produce a nonzero exit status; image-difference metrics do
|
|
not have an invented acceptance threshold.
|
|
|
|
The script defaults to system `/usr/bin` Poppler tools when present. Override
|
|
with `DOCVIEW_PDFTOPPM`, `DOCVIEW_PDFTOTEXT` and `DOCVIEW_PDFFONTS`, or choose a
|
|
different build directory with `DOCVIEW_BUILD_DIR`.
|
|
|
|
Explicit limitations: vertical text uses individual positioned glyphs, not native
|
|
vertical CID metrics or OpenType shaping; ruby positions are authored directly;
|
|
CMYK has no calibrated ICC golden; unembedded font coverage is Standard-14 Latin
|
|
only. This corpus does not establish arbitrary-document, Windows, accessibility,
|
|
print-production or full PDF compatibility.
|
|
|
|
## ICC profile and additional scale checks
|
|
|
|
`../icc_generator.py` creates `linear-srgb.icc` from D65 white, sRGB primaries
|
|
and gamma 1 through public LittleCMS APIs. It uses no downloaded or borrowed
|
|
profile. The generated copyright tag reads `No copyright, use freely`; the
|
|
LittleCMS MIT license is retained in `LCMS2-LICENSE.txt`. The manifest records
|
|
the numeric parameters, profile hash, library version and upstream source.
|
|
The profile's creation timestamp is fixed, and its optional ID is zero, for
|
|
reproducibility. The same profile bytes are embedded for vector and image colors.
|
|
|
|
Run `python3 tests/fixtures/pdf/icc_generator.py` to add/rebuild only this fixture
|
|
without requiring the Japanese font. The full generator includes it as well.
|
|
`python3 tests/compare_pdf_icc.py` compares actual worker scales 0.5, 1 and 4
|
|
against Poppler at 36/72/288 dpi. It checks 54 analytic color probes, page
|
|
dimensions and original SHA-256. Linear 0.5 gray must differ materially from
|
|
DeviceRGB 0.5; this prevents an ignored ICC profile from passing. Evidence is
|
|
in [pdf-icc](../../../results/pdf-icc/README.md). This one RGB profile does not
|
|
establish arbitrary ICC LUT, CMYK press calibration or print color proofing.
|