A PDF's facts above the viewer
Open a .pdf on a repository's blob page: above the browser's own viewer a
strip says how many pages it has and, when the file's info dictionary names
them, its title and author. A file with neither shows only the page count.
- Where it is read:
src/web/render/pdf-meta.ts. The page count is the/Countof the catalog's page-tree root; when the tree sits in compressed object streams the page objects that can be seen are counted. Title and Author come from the info dictionary the last trailer points at (an appended update wins). Literal and hex strings are read, UTF-16 included; each is cut at 300 characters and control characters become spaces. At most the first 8 MiB of the file is scanned. - Escaping: the strings are drawn through the
htmltemplate, so a hostile title shows as text. - Left out: compressed object streams and XMP metadata are not read, and a PDF over the page's read ceiling (empty body) shows no strip.
- Terminal: there is no door. The terminal has no blob or file view and draws no PDFs (it lists no file contents at all), so there is nothing for these facts to annotate; they would belong on a terminal blob view if one is ever built.
- Try it: open
/<owner>/<repo>/blob/<ref>/<file>.pdf. Tests:test/render-pdf-meta.test.ts.