Documentation ¶
Index ¶
- Constants
- type Array
- type Boolean
- type Dictionary
- type Fpdi
- type Hex
- type Null
- type Numeric
- type Object
- type ObjectDeclaration
- type ObjectRef
- type PDFPage
- type PDFParser
- type PDFTokenReader
- func (reader *PDFTokenReader) Close()
- func (reader *PDFTokenReader) Peek(n int) []byte
- func (reader *PDFTokenReader) PeekTokens(n int) []Token
- func (reader *PDFTokenReader) ReadByte() (byte, bool)
- func (reader *PDFTokenReader) ReadBytes(n int) ([]byte, bool)
- func (reader *PDFTokenReader) ReadBytesToToken(token Token) ([]byte, bool)
- func (reader *PDFTokenReader) ReadLine() []byte
- func (reader *PDFTokenReader) ReadLinesToToken(token Token) ([][]byte, bool)
- func (reader *PDFTokenReader) ReadToken() Token
- func (reader *PDFTokenReader) ReadTokens(n int) []Token
- func (reader *PDFTokenReader) ReadTokensToToken(token Token) ([]Token, bool)
- func (reader *PDFTokenReader) Reset() (int64, error)
- func (reader *PDFTokenReader) Seek(offset int64, whence int) (int64, error)
- func (reader *PDFTokenReader) SkipBytes(n int) bool
- func (reader *PDFTokenReader) SkipToToken(token Token) bool
- func (reader *PDFTokenReader) SplitLines(data []byte) [][]byte
- func (reader *PDFTokenReader) SplitTokens(data []byte) []Token
- type PageBox
- type PageBoxes
- type Real
- type Stream
- type String
- type TemplatePage
- type Token
- type Value
- type ValueType
Constants ¶
const ( // MediaBox is a bounding box that includes bleed area and crop marks MediaBox = "MediaBox" // CropBox is a bounding bos that denotes the area the page should be cropped for display CropBox = "CropBox" // BleedBox is a bounding box that includes bleed area BleedBox = "BleedBox" // TrimBox is a bounding box that dentoes the area the page should be trimmed for printing TrimBox = "TrimBox" // ArtBox is a bounding bxo that denotes an interesting part of the page ArtBox = "ArtBox" // DefaultBox is the default bounding box to use DefaultBox = CropBox )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Array ¶
type Array []Value
Array is a sequence of value
type Boolean ¶
type Boolean bool
Boolean is a boolean value
type Dictionary ¶
Dictionary is a mapping from names to values
func (Dictionary) Equals ¶
func (d Dictionary) Equals(v Value) bool
Equals checks if the value is an equivalent dictionary
type Fpdi ¶
type Fpdi struct {
// contains filtered or unexported fields
}
Fpdi represents a PDF file parser which can load templates to use in other documents
func OpenFromFileName ¶
Open makes an existing PDF file usable for templates
func (*Fpdi) Close ¶
func (td *Fpdi) Close()
Close releases references and closes the file handle of the parser
func (*Fpdi) CountPages ¶
CountPages returns the number of pages in this source document
func (*Fpdi) GetLastUsedPageBox ¶
GetLastUsedPageBox returns the last used page boundary box.
func (*Fpdi) ImportPage ¶
ImportPage imports a single page of the source document to use as a template in another document
type Hex ¶
type Hex string
Hex is a hex value
type Numeric ¶
type Numeric int64
Numeric is an integer value
type ObjectDeclaration ¶
ObjectDeclaration is a object identifier
func (ObjectDeclaration) Equals ¶
func (r ObjectDeclaration) Equals(v Value) bool
Equals checks if the value is also null
func (ObjectDeclaration) Type ¶
func (r ObjectDeclaration) Type() ValueType
Type of a ObjectRef value
type ObjectRef ¶
ObjectRef is an indirect object reference
type PDFPage ¶
type PDFPage struct { Dictionary Number int }
PDFPage is a page extracted from an existing PDF document
type PDFParser ¶
type PDFParser struct {
// contains filtered or unexported fields
}
PDFParser is a high-level parser for PDF elements See fpdf_pdf_parser.php
func OpenPDFParser ¶
OpenPDFParser opens an existing PDF file and readies it
type PDFTokenReader ¶
type PDFTokenReader struct {
// contains filtered or unexported fields
}
PDFTokenReader is a low-level reader for the tokens in a PDF file See pdf_parser.php and pdf_context.php
func NewTokenReader ¶
func NewTokenReader(file *os.File) (*PDFTokenReader, error)
NewTokenReader constructs a low level reader for a PDF file
func (*PDFTokenReader) Close ¶
func (reader *PDFTokenReader) Close()
Close releases references and closes the file handle of the parser
func (*PDFTokenReader) Peek ¶
func (reader *PDFTokenReader) Peek(n int) []byte
Peek looks ahead to get data but doesn't move the file pointer at all
func (*PDFTokenReader) PeekTokens ¶
func (reader *PDFTokenReader) PeekTokens(n int) []Token
PeekTokens looks ahead to get tokens but doesn't move the file pointer at all
func (*PDFTokenReader) ReadByte ¶
func (reader *PDFTokenReader) ReadByte() (byte, bool)
ReadByte gets a single byte
func (*PDFTokenReader) ReadBytes ¶
func (reader *PDFTokenReader) ReadBytes(n int) ([]byte, bool)
ReadBytes reads up to a fixed number of bytes
func (*PDFTokenReader) ReadBytesToToken ¶
func (reader *PDFTokenReader) ReadBytesToToken(token Token) ([]byte, bool)
ReadBytesToToken reads all bytes from current position until the next instance of the given token If the token cannot be found, returns nil
func (*PDFTokenReader) ReadLine ¶
func (reader *PDFTokenReader) ReadLine() []byte
ReadLine gets a line of tokens
func (*PDFTokenReader) ReadLinesToToken ¶
func (reader *PDFTokenReader) ReadLinesToToken(token Token) ([][]byte, bool)
ReadLinesToToken reads all lines from the current position until the next instance of the given token If the token cannot be found, returns nil
func (*PDFTokenReader) ReadToken ¶
func (reader *PDFTokenReader) ReadToken() Token
ReadToken gets the next PDF token
func (*PDFTokenReader) ReadTokens ¶
func (reader *PDFTokenReader) ReadTokens(n int) []Token
ReadTokens reads a fixed number of tokens
func (*PDFTokenReader) ReadTokensToToken ¶
func (reader *PDFTokenReader) ReadTokensToToken(token Token) ([]Token, bool)
ReadTokensToToken reads all tokens from the current position until the next instance of the given token If the token cannot be found, returns nil
func (*PDFTokenReader) Reset ¶
func (reader *PDFTokenReader) Reset() (int64, error)
Reset a reader to the start of the file
func (*PDFTokenReader) Seek ¶
func (reader *PDFTokenReader) Seek(offset int64, whence int) (int64, error)
Seek to a given point in the file
func (*PDFTokenReader) SkipBytes ¶
func (reader *PDFTokenReader) SkipBytes(n int) bool
func (*PDFTokenReader) SkipToToken ¶
func (reader *PDFTokenReader) SkipToToken(token Token) bool
SkipToToken seeks ahead to the first instance of the given token
func (*PDFTokenReader) SplitLines ¶
func (reader *PDFTokenReader) SplitLines(data []byte) [][]byte
SplitLines separates data into lines using the calibrated line ending
func (*PDFTokenReader) SplitTokens ¶
func (reader *PDFTokenReader) SplitTokens(data []byte) []Token
SplitTokens separates data into tokens with PDF syntax
type PageBox ¶
type PageBox struct { gofpdf.PointType gofpdf.SizeType Lower gofpdf.PointType // llx, lly Upper gofpdf.PointType // urx, ury }
PageBox is the bounding box for a page
type PageBoxes ¶
type PageBoxes struct {
// contains filtered or unexported fields
}
PageBoxes is a transient collection of the page boxes used in a document The keys are the constants: MediaBox, CrobBox, BleedBox, TrimBox, ArtBox
type Real ¶
type Real float64
Real is a floating-point value
type Stream ¶
type Stream []byte
Stream is a blob value
type String ¶
type String string
String is a string value
type TemplatePage ¶
type TemplatePage struct {
// contains filtered or unexported fields
}
TemplatePage is a page template, read from an existing page, that can be used in other documents.
func (*TemplatePage) Bytes ¶
func (t *TemplatePage) Bytes() []byte
Bytes returns the actual template data, not including resources
func (*TemplatePage) ID ¶
func (t *TemplatePage) ID() int64
ID returns the global template identifier
func (*TemplatePage) Images ¶
func (t *TemplatePage) Images() map[string]*gofpdf.ImageInfoType
Images returns a list of the images used by this template
func (*TemplatePage) Size ¶
func (t *TemplatePage) Size() (gofpdf.PointType, gofpdf.SizeType)
Size gives the bounding dimensions of this template
func (*TemplatePage) Templates ¶
func (t *TemplatePage) Templates() []gofpdf.Template
Templates returns a list of templates used within this template
type Token ¶
type Token []byte
Token is a unit of PDF syntax. Not all tokens can be safely represented as strings.