pdftest

package
v2.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package pdftest builds small pdfs in memory for tests that need a real text layer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(pages [][]string, composite bool) []byte

Build writes a pdf with one page per entry, each line of text on its own row. composite selects a Type0 font with a ToUnicode map so the text is encoded as two byte glyph ids

func BuildEncoded

func BuildEncoded(pages [][]string, name string, charset *charmap.Charmap) []byte

BuildEncoded writes a pdf in a simple font that declares the named base encoding, such as MacRomanEncoding, with every line encoded through charset the way that encoding stores it

func BuildGlyphs

func BuildGlyphs(pages [][]string) []byte

BuildGlyphs writes a pdf in the composite font that places every glyph on its own, leaving word gaps only in the Td distance, the way some html to pdf renderers lay out text

func EncryptPDF

func EncryptPDF(t *testing.T, pdf []byte, userPW string) []byte

EncryptPDF returns pdf encrypted with AES-256, an owner password, and the given user password

func MinimalPDF

func MinimalPDF(t *testing.T) []byte

MinimalPDF returns a single page pdf with one line of text

func Repeat

func Repeat(lines []string, count int) []byte

Repeat builds a pdf with the same lines on every one of count pages, numbering each page

Types

This section is empty.

Jump to

Keyboard shortcuts

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