numtree

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package numtree implements PDF number trees.

Number trees map integers to PDF objects. In PDF files these trees are used in two differnt contexts:

  • The `PageLabels` entry in the document catalog is a number tree defining page labels for the pages in the document.
  • The `ParentTree` entry in the structure tree root dictionary is a number tree used in finding the structure elements to which content items belong.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyNotFound = errors.New("key not found")
)

Functions

func Write

func Write(w pdf.Putter, tree Tree) (pdf.Reference, error)

Types

type SequentialWriter

type SequentialWriter struct {
	// contains filtered or unexported fields
}

func NewSequentialWriter

func NewSequentialWriter(w pdf.Putter) *SequentialWriter

func (*SequentialWriter) Append

func (sw *SequentialWriter) Append(key pdf.Integer, val pdf.Object) error

func (*SequentialWriter) Close

func (sw *SequentialWriter) Close() error

func (*SequentialWriter) Reference

func (sw *SequentialWriter) Reference() pdf.Reference

type Tree

type Tree interface {
	// Get returns the value for a given key.  If the key is not
	// found, Get returns ErrKeyNotFound.
	Get(key pdf.Integer) (pdf.Object, error)

	// First returns the smallest key in the tree.  If the tree is
	// empty, First returns ErrKeyNotFound.
	First() (pdf.Integer, error)

	// Next returns the smallest key in the tree which is strictly larger
	// than the given key.  If there is no such key, Next returns
	// ErrKeyNotFound.
	Next(after pdf.Integer) (pdf.Integer, error)

	// Prev returns the largest key in the tree which is smaller than or equal
	// to the given key.  If there is no such key, Prev returns ErrKeyNotFound.
	Prev(before pdf.Integer) (pdf.Integer, error)
}

func Read

func Read(r pdf.Getter, root pdf.Object) (Tree, error)

Jump to

Keyboard shortcuts

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