attachments

package
v1.117.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package attachments embeds files in a PDF as an incremental update: each goes in the catalog's embedded files and among the files associated with the document (/AF), where a reader lists it and a program finds it without reading the pages.

Index

Constants

View Source
const (
	RelationshipSource      = "Source"
	RelationshipData        = "Data"
	RelationshipAlternative = "Alternative"
	RelationshipSupplement  = "Supplement"
	RelationshipUnspecified = "Unspecified"
)

The relationships ISO 32000-2 names between a document and a file associated with it.

Variables

View Source
var (
	ErrDuplicateName = errors.New("an embedded file of that name is already in the document")
	ErrInvalidFile   = errors.New("invalid embedded file")
)

Functions

func Attach

func Attach(data []byte, files ...*File) ([]byte, error)

Attach returns the document with the files embedded in an incremental update; the document's bytes are an exact prefix of the result.

Types

type File

type File struct {
	Name         string
	Description  string
	MimeType     string
	Relationship string
	ModifiedAt   time.Time
	Data         []byte
}

File is a file to embed.

Jump to

Keyboard shortcuts

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