Help us shape the future of Go! Take the 2026 Go Developer Survey

pdfx

package
v0.1.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package pdfx reads and stamps the PDFs Chrome prints for lfm: page counts, outline targets, transparency and the provenance stamp that lets a later compile reuse a print.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FigurePages added in v0.1.12

func FigurePages(pdf []byte) map[string]int

FigurePages counts the distinct pages occupied by each labelled figure in Chrome's tagged PDF. A figure painted on multiple pages has been split.

func OutlinePages

func OutlinePages(pdf []byte) []int

OutlinePages returns the page number (from 1) of every top-level bookmark of a PDF Chrome printed with a document outline, in order. Chrome builds the outline from the headings, so a book's chapters are its last entries. It returns nil when the structure cannot be read.

func PageCount

func PageCount(pdf []byte) int

PageCount returns the number of pages of a PDF: the largest /Count of a page tree node, or, without one, the number of page objects. Chrome writes its page tree uncompressed, which is all lfm needs to read.

func Stamp

func Stamp(pdf []byte, key string) ([]byte, error)

Stamp records key in a PDF's document information, the inputs it was printed from, as an incremental update: the printed bytes stay untouched and the file stays a valid PDF. A later compile reuses the file when its key still matches instead of printing it again.

func StampOf

func StampOf(pdf []byte) string

StampOf returns the key a PDF was stamped with, or "".

func Transparent

func Transparent(pdf []byte) bool

Transparent reports whether a PDF Chrome printed contains transparency: partial opacity or images with an alpha channel. Printers want it flattened. It looks only where an opacity or mask key starts, so a large PDF is scanned at memory speed.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL