Documentation ¶
Index ¶
- Constants
- type Importer
- func (this *Importer) GetImportedObjHashPos() map[string]map[int]string
- func (this *Importer) GetImportedObjects() map[int]string
- func (this *Importer) GetImportedObjectsUnordered() map[string][]byte
- func (this *Importer) GetNumPages() int
- func (this *Importer) GetPageSizes() map[int]map[string]map[string]float64
- func (this *Importer) GetReader() *PdfReader
- func (this *Importer) GetReaderForFile(file string) *PdfReader
- func (this *Importer) GetWriter() *PdfWriter
- func (this *Importer) GetWriterForFile(file string) *PdfWriter
- func (this *Importer) ImportPage(pageno int, box string) int
- func (this *Importer) PutFormXobjects() map[string]int
- func (this *Importer) PutFormXobjectsUnordered() map[string]string
- func (this *Importer) SetNextObjectID(objId int)
- func (this *Importer) SetSourceFile(f string)
- func (this *Importer) SetSourceStream(rs *io.ReadSeeker)
- func (this *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 (this *PdfWriter) ClearImportedObjects()
- func (this *PdfWriter) GetImportedObjHashPos() map[*PdfObjectId]map[int]string
- func (this *PdfWriter) GetImportedObjects() map[*PdfObjectId][]byte
- func (this *PdfWriter) ImportPage(reader *PdfReader, pageno int, boxName string) (int, error)
- func (this *PdfWriter) Init()
- func (this *PdfWriter) PutFormXobjects(reader *PdfReader) (map[string]*PdfObjectId, error)
- func (this *PdfWriter) SetNextObjectID(id int)
- func (this *PdfWriter) SetTplIdOffset(n int)
- func (this *PdfWriter) SetUseHash(b bool)
- func (this *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 (this *Importer) SetSourceStream(rs *io.ReadSeeker)
func (*Importer) UseTemplate ¶
func (this *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 (this *PdfWriter) ClearImportedObjects()
func (*PdfWriter) GetImportedObjHashPos ¶
func (this *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 (this *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 (this *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