Documentation ¶
Overview ¶
Package pagetree implements PDF page trees.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindPages ¶ added in v0.4.0
FindPages returns a list of all pages in the document. The returned list contains the references to the page dictionaries.
Types ¶
type Iterator ¶ added in v0.4.0
type Iterator struct { Err error // contains filtered or unexported fields }
func NewIterator ¶ added in v0.4.0
func (*Iterator) All ¶ added in v0.4.0
All returns a function which iterates over all pages in the document. The arguments are the reference to the page dictionary and the page dictionary itself.
The function must return true if the iteration should continue, or false if it should stop.
TODO(voss): change this to iterate over (page number, page dictionary) pairs?
type Writer ¶
Writer writes a page tree to a PDF file.
func (*Writer) AppendPage ¶
AppendPage adds a new page to the page tree.
This function takes ownership of the pageDict object, and adds the /Parent entry before writing the object to the PDF file.
func (*Writer) AppendPageRef ¶ added in v0.3.0
AppendPageRef adds a new page to the page tree, using the given reference for the page dictionary.
This function takes ownership of the pageDict object, and adds the /Parent entry before writing the object to the PDF file.
func (*Writer) Close ¶
Close closes the current tree and all subtrees. After a tree has been closed, no more pages can be added.
If the tree is the root of a page tree, the complete tree is written to the PDF file and a reference to the root node is returned. Otherwise, the returned reference is nil.
TODO(voss): get rid of the Reference return value
func (*Writer) NewRange ¶ added in v0.3.4
NewRange creates a new Writer that can insert pages into a PDF document at position position current at the time of the call. Pages added to the parent Writer will be inserted after the pages from the newly returned Writer.
func (*Writer) NextPageNumber ¶
NextPageNumber registers a callback that will be called when the absolute page number of the next page to be added is known. Page numbers are relative to the start of the document, starting at 0.
The callback will be called with -1 if the page tree is closed before another page is added.