Documentation ¶
Overview ¶
Package file builds upon a parser to read an existing PDF file, producing a tree of PDF objets. See pacakge reader for an higher level of processing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Configuration ¶
type Configuration struct { // Either owner or user password. // TODO: We don't support changing permissions, // so both password acts the same. Password string }
func NewDefaultConfiguration ¶
func NewDefaultConfiguration() *Configuration
type FDFFile ¶
type FDFFile struct { XrefTable Version string Root model.ObjIndirectRef }
FDFFile is an in-memory version of a .fdf file, used to fill PDF forms.
func ReadFDF ¶
func ReadFDF(rs io.ReadSeeker) (FDFFile, error)
ReadFDF process a FDF file, loading objects in memory.
func ReadFDFFile ¶
ReadFDFFile is the same as ReadFDF, but takes a file name as input.
type IncorrectPasswordErr ¶
type IncorrectPasswordErr string
IncorrectPasswordErr is returned when the given password is not correct.
func (IncorrectPasswordErr) Error ¶
func (ip IncorrectPasswordErr) Error() string
type PDFFile ¶
type PDFFile struct { XrefTable // The PDF version the source is claiming to us as per its header. HeaderVersion string // AdditionalStreams (array of IndirectRef) is not described in the spec, // but may be found in the trailer :e.g., Oasis "Open Doc" AdditionalStreams parser.Array // Reference to the Catalog root dictionnary Root parser.IndirectRef // Optionnal reference to the Info dictionnary, containing metadata. Info *parser.IndirectRef // ID is found in the trailer, and used for encryption ID [2]string // Encryption dictionary found in the trailer. Optionnal. Encrypt *model.Encrypt }
PDFFile represents a parsed PDF file. It is mainly composed of a store of objects (model.Object), identified by their reference (model.ObjIndirectRef). It usually requires more processing to be really useful: see the packages 'reader' and 'model'.
func Read ¶
func Read(rs io.ReadSeeker, conf *Configuration) (PDFFile, error)
Read process a PDF file, reading the xref table and loading objects in memory.
type XrefTable ¶
XrefTable maps object numbers to objects.
func (XrefTable) ResolveObject ¶
ResolveObject use the xref table to resolve indirect reference. If the reference is invalid, the ObjNull{} is returned. As convenience, direct objects may also be passed and will be returned as it is.