pdfbuild

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pdfbuild assembles a minimal PDF file from a list of objects, for tests.

It exists for the same reason internal/ttfbuild does, and the reason is the cross-reference table. Numbering objects from 1, recording each one's byte offset, and writing an xref whose entries are ten-digit offsets in the right order is the only real logic in a hand-built fixture — and it is logic a reader has to get right before any test using the file means anything. Copied into a second test package it would be the same defect as arithmetic duplicated in two packages: a fix to one is invisible to the other, and a subtly wrong offset table fails as "pdfcpu could not open this" in a test that is about something else entirely.

Two packages need it: render/native, whose fixtures are streams no producer would emit, and cmd/pdfspec, whose fixtures are font dictionaries no producer would emit.

Not in a _test.go file, because an internal package cannot export from one. Internal so it cannot become part of the module's surface by accident.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(objs []string) []byte

Bytes returns a one-revision PDF whose objects are numbered 1..len(objs) in the order given.

Object 1 is taken as the catalogue, since /Root has to name something and every caller writes it first. Nothing here validates the objects: a fixture's whole purpose is often to be malformed in one specific way, and a builder that rejected that would be useless for the tests that need it most.

Types

This section is empty.

Jump to

Keyboard shortcuts

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