Documentation
¶
Overview ¶
Package pdfstruct provides methods for reading and updating the basic structure of a PDF. It doesn't understand the semantics of the PDF at all; it just knows how to locate, parse, update, add, and remove objects.
Index ¶
- type Array
- type Dict
- type Name
- type Object
- type PDF
- func (p *PDF) CreateObject(obj Object) (ref Reference)
- func (p *PDF) Get(r Reference) (obj Object, err error)
- func (p *PDF) GetArray(r Reference) (array Array, err error)
- func (p *PDF) GetDict(r Reference) (dict Dict, err error)
- func (p *PDF) GetStream(r Reference) (stream Stream, err error)
- func (p *PDF) GetString(r Reference) (str string, err error)
- func (p *PDF) UpdateObject(ref Reference, obj Object)
- func (p *PDF) Write() (err error)
- type Reader
- type Reference
- type Stream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Object ¶
type Object any
An Object is an object as defined by the PDF specification. While an Object is defined as "any", it will in fact be one of the following:
- nil (a null object)
- bool
- int
- float64
- string
- []byte (a hex string)
- Name
- Array
- Dict
- Stream
- Reference
type PDF ¶
A PDF is a reference to a PDF file.
func Open ¶
Open opens a PDF file. The supplied file handle must honor io.ReadSeeker, but if Write is going to be called, it must also honor io.Writer.
func (*PDF) CreateObject ¶
CreateObject creates a new object with the specified content, and returns a reference to it. The new content will be written if Write is called.
func (*PDF) UpdateObject ¶
UpdateObject registers new content for the object with the specified reference. The new content will be written if Write is called.
type Stream ¶
A Stream is a Dict followed by a block of arbitrary data. Note that when retrieved from the pdfstruct library, stream data has been decompressed and decoded.
func (*Stream) Decompress ¶
Decompress removes any compression and/or encoding from the stream data. Some encoding methods need to know the size (in bytes) of a "row" in the data for decoding, so that is a parameter.