Documentation ¶
Index ¶
- Constants
- type Importer
- func (im *Importer) GetImportedObjHashPos() map[string]map[int]string
- func (im *Importer) GetImportedObjects() map[int]string
- func (im *Importer) GetImportedObjectsUnordered() map[string][]byte
- func (im *Importer) GetNumPages() int
- func (im *Importer) GetPageSizes() map[int]map[string]map[string]float64
- func (im *Importer) GetReader() *PdfReader
- func (im *Importer) GetReaderForFile(file string) *PdfReader
- func (im *Importer) GetWriter() *PdfWriter
- func (im *Importer) GetWriterForFile(file string) *PdfWriter
- func (im *Importer) ImportPage(pageno int, box string) int
- func (im *Importer) PutFormXobjects() map[string]int
- func (im *Importer) PutFormXobjectsUnordered() map[string]string
- func (im *Importer) SetNextObjectID(objId int)
- func (im *Importer) SetSourceFile(f string)
- func (im *Importer) SetSourceStream(rs *io.ReadSeeker)
- func (im *Importer) UseTemplate(tplid int, _x float64, _y float64, _w float64, _h float64) (string, float64, float64, float64, float64)
- type PdfObject
- type PdfObjectId
- type PdfReader
- type PdfTemplate
- type PdfValue
- type PdfWriter
- func (pw *PdfWriter) ClearImportedObjects()
- func (pw *PdfWriter) GetImportedObjHashPos() map[*PdfObjectId]map[int]string
- func (pw *PdfWriter) GetImportedObjects() map[*PdfObjectId][]byte
- func (pw *PdfWriter) ImportPage(reader *PdfReader, pageno int, boxName string) (int, error)
- func (pw *PdfWriter) Init()
- func (pw *PdfWriter) PutFormXobjects(reader *PdfReader) (map[string]*PdfObjectId, error)
- func (pw *PdfWriter) SetNextObjectID(id int)
- func (pw *PdfWriter) SetTplIdOffset(n int)
- func (pw *PdfWriter) SetUseHash(b bool)
- func (pw *PdfWriter) UseTemplate(tplid int, _x float64, _y float64, _w float64, _h float64) (string, float64, float64, float64, float64)
- type TplInfo
Constants ¶
const ( PDF_TYPE_NULL = iota PDF_TYPE_NUMERIC PDF_TYPE_TOKEN PDF_TYPE_HEX PDF_TYPE_STRING PDF_TYPE_DICTIONARY PDF_TYPE_ARRAY PDF_TYPE_OBJDEC PDF_TYPE_OBJREF PDF_TYPE_OBJECT PDF_TYPE_STREAM PDF_TYPE_BOOLEAN PDF_TYPE_REAL )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Importer ¶
type Importer struct {
// contains filtered or unexported fields
}
The Importer class to be used by a pdf generation library
func NewImporter ¶
func NewImporter() *Importer
func (*Importer) GetImportedObjHashPos ¶
Get the positions of the hashes (sha1 - 40 characters) within each object, to be replaced with actual objects ids by the pdf generator library
func (*Importer) GetImportedObjects ¶
Get object ids (int) and their contents (string)
func (*Importer) GetImportedObjectsUnordered ¶
Get object ids (sha1 hash) and their contents ([]byte) The contents may have references to other object hashes which will need to be replaced by the pdf generator library The positions of the hashes (sha1 - 40 characters) can be obtained by calling GetImportedObjHashPos()
func (*Importer) GetNumPages ¶
func (*Importer) GetPageSizes ¶
func (*Importer) GetReaderForFile ¶
func (*Importer) GetWriterForFile ¶
func (*Importer) PutFormXobjects ¶
Put form xobjects and get back a map of template names (e.g. /GOFPDITPL1) and their object ids (int)
func (*Importer) PutFormXobjectsUnordered ¶
Put form xobjects and get back a map of template names (e.g. /GOFPDITPL1) and their object ids (sha1 hash)
func (*Importer) SetNextObjectID ¶
func (*Importer) SetSourceFile ¶
func (*Importer) SetSourceStream ¶
func (im *Importer) SetSourceStream(rs *io.ReadSeeker)
func (*Importer) UseTemplate ¶
func (im *Importer) UseTemplate(tplid int, _x float64, _y float64, _w float64, _h float64) (string, float64, float64, float64, float64)
For a given template id (returned from ImportPage), get the template name (e.g. /GOFPDITPL1) and the 4 float64 values necessary to draw the template a x,y for a given width and height.
type PdfObjectId ¶
type PdfObjectId struct {
// contains filtered or unexported fields
}
type PdfReader ¶
type PdfReader struct {
// contains filtered or unexported fields
}
func NewPdfReader ¶
func NewPdfReaderFromStream ¶
func NewPdfReaderFromStream(sourceFile string, rs io.ReadSeeker) (*PdfReader, error)
type PdfTemplate ¶
type PdfTemplate struct { Id int Reader *PdfReader Resources *PdfValue Buffer string Box map[string]float64 Boxes map[string]map[string]float64 X float64 Y float64 W float64 H float64 Rotation int N int }
Done with parsing. Now, create templates.
type PdfWriter ¶
type PdfWriter struct {
// contains filtered or unexported fields
}
func NewPdfWriter ¶
func (*PdfWriter) ClearImportedObjects ¶
func (pw *PdfWriter) ClearImportedObjects()
func (*PdfWriter) GetImportedObjHashPos ¶
func (pw *PdfWriter) GetImportedObjHashPos() map[*PdfObjectId]map[int]string
For each object (uniquely identified by a sha1 hash), return the positions of each hash within the object, to be replaced with pdf object ids (integers)
func (*PdfWriter) GetImportedObjects ¶
func (pw *PdfWriter) GetImportedObjects() map[*PdfObjectId][]byte
func (*PdfWriter) ImportPage ¶
Create a PdfTemplate object from a page number (e.g. 1) and a boxName (e.g. MediaBox)
func (*PdfWriter) PutFormXobjects ¶
func (pw *PdfWriter) PutFormXobjects(reader *PdfReader) (map[string]*PdfObjectId, error)
Output Form XObjects (1 for each template) returns a map of template names (e.g. /GOFPDITPL1) to PdfObjectId