Documentation ¶
Index ¶
- Constants
- Variables
- func CheckSum(data []byte) uint64
- func Chr(n int) byte
- func ContentObj_CalTextHeight(fontsize int) float64
- func CreateEmbeddedFontSubsetName(name string) string
- func DebugSubType(b []byte)
- func DesignUnitsToPdf(val int64, unitsPerEm uint64) int64
- func FontConvertHelper_Cw2Str(cw FontCw) string
- func ReadShortFromByte(data []byte, offset int) (int64, int)
- func ReadUShortFromByte(data []byte, offset int) (uint64, int)
- func StrHelperGetStringWidth(str string, fontSize int, ifont IFont) float64
- func ToByte(chr string) byte
- func WriteBytes(w io.Writer, data []byte, offset int, count int) error
- func WriteTag(w io.Writer, tag string) error
- func WriteUInt16(w io.Writer, v uint) error
- func WriteUInt32(w io.Writer, v uint) error
- type BasicObj
- type Buff
- type CIDFontObj
- func (me *CIDFontObj) Build() error
- func (me *CIDFontObj) GetObjBuff() *bytes.Buffer
- func (me *CIDFontObj) GetType() string
- func (me *CIDFontObj) Init(funcGetRoot func() *GoPdf)
- func (me *CIDFontObj) SetIndexObjSubfontDescriptor(index int)
- func (me *CIDFontObj) SetPtrToSubsetFontObj(ptr *SubsetFontObj)
- type CatalogObj
- type Config
- type ContentObj
- func (c *ContentObj) AppendStream(rectangle *Rect, text string)
- func (c *ContentObj) AppendStreamImage(index int, x float64, y float64, rect *Rect)
- func (c *ContentObj) AppendStreamLine(x1 float64, y1 float64, x2 float64, y2 float64)
- func (c *ContentObj) AppendStreamOval(x1 float64, y1 float64, x2 float64, y2 float64)
- func (c *ContentObj) AppendStreamSetGrayFill(w float64)
- func (c *ContentObj) AppendStreamSetGrayStroke(w float64)
- func (c *ContentObj) AppendStreamSetLineWidth(w float64)
- func (c *ContentObj) AppendStreamSubsetFont(rectangle *Rect, text string)
- func (c *ContentObj) AppendUnderline(startX float64, y float64, endX float64, endY float64, text string)
- func (c *ContentObj) Build() error
- func (c *ContentObj) GetObjBuff() *bytes.Buffer
- func (c *ContentObj) GetType() string
- func (c *ContentObj) Init(funcGetRoot func() *GoPdf)
- type Current
- type EmbedFontObj
- type EncodingObj
- type FontCw
- type FontDescItem
- type FontDescriptorObj
- func (f *FontDescriptorObj) Build() error
- func (f *FontDescriptorObj) GetFont() IFont
- func (f *FontDescriptorObj) GetObjBuff() *bytes.Buffer
- func (f *FontDescriptorObj) GetType() string
- func (f *FontDescriptorObj) Init(funcGetRoot func() *GoPdf)
- func (f *FontDescriptorObj) SetFont(font IFont)
- func (f *FontDescriptorObj) SetFontFileObjRelate(relate string)
- type FontObj
- func (f *FontObj) Build() error
- func (f *FontObj) GetObjBuff() *bytes.Buffer
- func (f *FontObj) GetType() string
- func (f *FontObj) Init(funcGetRoot func() *GoPdf)
- func (f *FontObj) SetIndexObjEncoding(index int)
- func (f *FontObj) SetIndexObjFontDescriptor(index int)
- func (f *FontObj) SetIndexObjWidth(index int)
- type GoPdf
- func (gp *GoPdf) AddFont(family string, ifont IFont, zfontpath string)
- func (gp *GoPdf) AddPage()
- func (gp *GoPdf) AddTTFFont(family string, ttfpath string) error
- func (gp *GoPdf) Br(h float64)
- func (gp *GoPdf) Cell(rectangle *Rect, text string)
- func (gp *GoPdf) GetBytesPdf() []byte
- func (gp *GoPdf) GetBytesPdfReturnErr() ([]byte, error)
- func (gp *GoPdf) GetX() float64
- func (gp *GoPdf) GetY() float64
- func (gp *GoPdf) Image(picPath string, x float64, y float64, rect *Rect)
- func (gp *GoPdf) Line(x1 float64, y1 float64, x2 float64, y2 float64)
- func (gp *GoPdf) Oval(x1 float64, y1 float64, x2 float64, y2 float64)
- func (gp *GoPdf) SetFont(family string, style string, size int) error
- func (gp *GoPdf) SetGrayFill(grayScale float64)
- func (gp *GoPdf) SetGrayStroke(grayScale float64)
- func (gp *GoPdf) SetLeftMargin(margin float64)
- func (gp *GoPdf) SetLineWidth(width float64)
- func (gp *GoPdf) SetTextColor(r uint8, g uint8, b uint8)
- func (gp *GoPdf) SetTopMargin(margin float64)
- func (gp *GoPdf) SetX(x float64)
- func (gp *GoPdf) SetY(y float64)
- func (gp *GoPdf) Start(config Config)
- func (gp *GoPdf) WritePdf(pdfPath string)
- type IFont
- type IObj
- type ISubset
- type ImageCache
- type ImageObj
- type PageObj
- type PagesObj
- type PdfDictionaryObj
- func (p *PdfDictionaryObj) AddCompositeGlyphs(glyphArray *[]int, glyph int)
- func (p *PdfDictionaryObj) Build() error
- func (p *PdfDictionaryObj) GetObjBuff() *bytes.Buffer
- func (p *PdfDictionaryObj) GetOffset(glyph int) int
- func (p *PdfDictionaryObj) GetType() string
- func (p *PdfDictionaryObj) Init(funcGetRoot func() *GoPdf)
- func (p *PdfDictionaryObj) SetPtrToSubsetFontObj(ptr *SubsetFontObj)
- type ProcSetObj
- type RealteXobject
- type RealteXobjects
- type Rect
- type RelateFont
- type RelateFonts
- type Rgb
- type SubfontDescriptorObj
- func (s *SubfontDescriptorObj) Build() error
- func (s *SubfontDescriptorObj) GetObjBuff() *bytes.Buffer
- func (s *SubfontDescriptorObj) GetType() string
- func (s *SubfontDescriptorObj) Init(func() *GoPdf)
- func (s *SubfontDescriptorObj) SetIndexObjPdfDictionary(index int)
- func (s *SubfontDescriptorObj) SetPtrToSubsetFontObj(ptr *SubsetFontObj)
- type SubsetFontObj
- func (s *SubsetFontObj) AddChars(txt string)
- func (s *SubsetFontObj) Build() error
- func (s *SubsetFontObj) CharCodeToGlyphIndex(r rune) uint64
- func (s *SubsetFontObj) CharIndex(r rune) (uint64, error)
- func (s *SubsetFontObj) CharWidth(r rune) (uint64, error)
- func (s *SubsetFontObj) GetFamily() string
- func (s *SubsetFontObj) GetObjBuff() *bytes.Buffer
- func (s *SubsetFontObj) GetTTFParser() *core.TTFParser
- func (s *SubsetFontObj) GetType() string
- func (s *SubsetFontObj) GetUt() int64
- func (s *SubsetFontObj) GlyphIndexToPdfWidth(glyphIndex uint64) uint64
- func (s *SubsetFontObj) Init(funcGetRoot func() *GoPdf)
- func (s *SubsetFontObj) SetFamily(familyname string)
- func (s *SubsetFontObj) SetIndexObjCIDFont(index int)
- func (s *SubsetFontObj) SetIndexObjUnicodeMap(index int)
- func (s *SubsetFontObj) SetTTFByPath(ttfpath string) error
- type UnicodeMap
Constants ¶
const ARG_1_AND_2_ARE_WORDS = 1
const CURRENT_FONT_TYPE_IFONT = 0
const CURRENT_FONT_TYPE_SUBSET = 1
const MORE_COMPONENTS = 32
const WE_HAVE_AN_X_AND_Y_SCALE = 64
const WE_HAVE_A_SCALE = 8
const WE_HAVE_A_TWO_BY_TWO = 128
Variables ¶
var EntrySelectors = []int{
0, 0, 1, 1, 2, 2,
2, 2, 3, 3, 3, 3,
3, 3, 3, 3, 4, 4,
4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4,
}
var ErrCharNotFound = errors.New("char not found")
var ErrNotSupportShortIndexYet = errors.New("not suport none short index yet!")
Functions ¶
func DebugSubType ¶
func DebugSubType(b []byte)
func DesignUnitsToPdf ¶
func StrHelperGetStringWidth ¶
Types ¶
type BasicObj ¶
type BasicObj struct { Data string // contains filtered or unexported fields }
BasicObj : basic object in pdf
type CIDFontObj ¶
type CIDFontObj struct { PtrToSubsetFontObj *SubsetFontObj // contains filtered or unexported fields }
func (*CIDFontObj) Build ¶
func (me *CIDFontObj) Build() error
func (*CIDFontObj) GetObjBuff ¶
func (me *CIDFontObj) GetObjBuff() *bytes.Buffer
func (*CIDFontObj) GetType ¶
func (me *CIDFontObj) GetType() string
func (*CIDFontObj) Init ¶
func (me *CIDFontObj) Init(funcGetRoot func() *GoPdf)
func (*CIDFontObj) SetIndexObjSubfontDescriptor ¶
func (me *CIDFontObj) SetIndexObjSubfontDescriptor(index int)
func (*CIDFontObj) SetPtrToSubsetFontObj ¶
func (me *CIDFontObj) SetPtrToSubsetFontObj(ptr *SubsetFontObj)
type CatalogObj ¶
type CatalogObj struct {
// contains filtered or unexported fields
}
func (*CatalogObj) Build ¶
func (me *CatalogObj) Build() error
func (*CatalogObj) GetObjBuff ¶
func (me *CatalogObj) GetObjBuff() *bytes.Buffer
func (*CatalogObj) GetType ¶
func (me *CatalogObj) GetType() string
func (*CatalogObj) Init ¶
func (me *CatalogObj) Init(funcGetRoot func() *GoPdf)
type ContentObj ¶
type ContentObj struct {
// contains filtered or unexported fields
}
func (*ContentObj) AppendStream ¶
func (c *ContentObj) AppendStream(rectangle *Rect, text string)
func (*ContentObj) AppendStreamImage ¶
func (c *ContentObj) AppendStreamImage(index int, x float64, y float64, rect *Rect)
func (*ContentObj) AppendStreamLine ¶
func (c *ContentObj) AppendStreamLine(x1 float64, y1 float64, x2 float64, y2 float64)
func (*ContentObj) AppendStreamOval ¶
func (c *ContentObj) AppendStreamOval(x1 float64, y1 float64, x2 float64, y2 float64)
func (*ContentObj) AppendStreamSetGrayFill ¶
func (c *ContentObj) AppendStreamSetGrayFill(w float64)
Set the grayscale fills
func (*ContentObj) AppendStreamSetGrayStroke ¶
func (c *ContentObj) AppendStreamSetGrayStroke(w float64)
Set the grayscale stroke
func (*ContentObj) AppendStreamSetLineWidth ¶
func (c *ContentObj) AppendStreamSetLineWidth(w float64)
func (*ContentObj) AppendStreamSubsetFont ¶
func (c *ContentObj) AppendStreamSubsetFont(rectangle *Rect, text string)
func (*ContentObj) AppendUnderline ¶
func (*ContentObj) Build ¶
func (c *ContentObj) Build() error
func (*ContentObj) GetObjBuff ¶
func (c *ContentObj) GetObjBuff() *bytes.Buffer
func (*ContentObj) GetType ¶
func (c *ContentObj) GetType() string
func (*ContentObj) Init ¶
func (c *ContentObj) Init(funcGetRoot func() *GoPdf)
type Current ¶
type Current struct { X float64 Y float64 //font IndexOfFontObj int CountOfFont int CountOfL int Font_Size int Font_Style string Font_FontCount int Font_Type int // CURRENT_FONT_TYPE_IFONT or CURRENT_FONT_TYPE_SUBSET Font_IFont IFont // depend on Font_Type Font_ISubset ISubset // depend on Font_Type //page IndexOfPageObj int //img CountOfImg int //cache of image in pdf file ImgCaches []ImageCache // contains filtered or unexported fields }
type EmbedFontObj ¶
type EmbedFontObj struct { Data string // contains filtered or unexported fields }
func (*EmbedFontObj) Build ¶
func (e *EmbedFontObj) Build() error
func (*EmbedFontObj) GetObjBuff ¶
func (e *EmbedFontObj) GetObjBuff() *bytes.Buffer
func (*EmbedFontObj) GetType ¶
func (e *EmbedFontObj) GetType() string
func (*EmbedFontObj) Init ¶
func (e *EmbedFontObj) Init(funcGetRoot func() *GoPdf)
func (*EmbedFontObj) SetFont ¶
func (e *EmbedFontObj) SetFont(font IFont, zfontpath string)
type EncodingObj ¶
type EncodingObj struct {
// contains filtered or unexported fields
}
func (*EncodingObj) Build ¶
func (e *EncodingObj) Build() error
func (*EncodingObj) GetFont ¶
func (e *EncodingObj) GetFont() IFont
func (*EncodingObj) GetObjBuff ¶
func (e *EncodingObj) GetObjBuff() *bytes.Buffer
func (*EncodingObj) GetType ¶
func (e *EncodingObj) GetType() string
func (*EncodingObj) Init ¶
func (e *EncodingObj) Init(funcGetRoot func() *GoPdf)
func (*EncodingObj) SetFont ¶
func (e *EncodingObj) SetFont(font IFont)
type FontDescItem ¶
type FontDescriptorObj ¶
type FontDescriptorObj struct {
// contains filtered or unexported fields
}
func (*FontDescriptorObj) Build ¶
func (f *FontDescriptorObj) Build() error
func (*FontDescriptorObj) GetFont ¶
func (f *FontDescriptorObj) GetFont() IFont
func (*FontDescriptorObj) GetObjBuff ¶
func (f *FontDescriptorObj) GetObjBuff() *bytes.Buffer
func (*FontDescriptorObj) GetType ¶
func (f *FontDescriptorObj) GetType() string
func (*FontDescriptorObj) Init ¶
func (f *FontDescriptorObj) Init(funcGetRoot func() *GoPdf)
func (*FontDescriptorObj) SetFont ¶
func (f *FontDescriptorObj) SetFont(font IFont)
func (*FontDescriptorObj) SetFontFileObjRelate ¶
func (f *FontDescriptorObj) SetFontFileObjRelate(relate string)
type FontObj ¶
type FontObj struct { Family string //Style string //Size int IsEmbedFont bool Font IFont CountOfFont int // contains filtered or unexported fields }
func (*FontObj) GetObjBuff ¶
func (*FontObj) SetIndexObjEncoding ¶
func (*FontObj) SetIndexObjFontDescriptor ¶
func (*FontObj) SetIndexObjWidth ¶
type GoPdf ¶
type GoPdf struct { //ต่ำแหน่งปัจจุบัน Curr Current // contains filtered or unexported fields }
GoPdf : A simple library for generating PDF written in Go lang
func (*GoPdf) AddTTFFont ¶
AddTTFFont : font use subtype font
func (*GoPdf) Cell ¶
Cell : create cell of text Note that this has no effect on Rect.H pdf (now). Fix later :-)
func (*GoPdf) GetBytesPdf ¶
GetBytesPdf : get bytes of pdf file
func (*GoPdf) GetBytesPdfReturnErr ¶
GetBytesPdfReturnErr : get bytes of pdf file
func (*GoPdf) SetGrayFill ¶
Set the grayscale for the fill, takes a float64 between 0.0 and 1.0
func (*GoPdf) SetGrayStroke ¶
Set the grayscale for the stroke, takes a float64 between 0.0 and 1.0
func (*GoPdf) SetLeftMargin ¶
SetLeftMargin : set left margin
func (*GoPdf) SetLineWidth ¶
SetLineWidth : set line width
func (*GoPdf) SetTextColor ¶
SetTextColor : function sets the text color
func (*GoPdf) SetTopMargin ¶
SetTopMargin : set top margin
type ImageCache ¶
type ImageObj ¶
type ImageObj struct {
// contains filtered or unexported fields
}
func (*ImageObj) GetObjBuff ¶
func (*ImageObj) SetImagePath ¶
type PageObj ¶
type PageObj struct { Contents string ResourcesRelate string // contains filtered or unexported fields }
func (*PageObj) GetObjBuff ¶
type PagesObj ¶
func (*PagesObj) GetObjBuff ¶
type PdfDictionaryObj ¶
type PdfDictionaryObj struct { PtrToSubsetFontObj *SubsetFontObj // contains filtered or unexported fields }
func (*PdfDictionaryObj) AddCompositeGlyphs ¶
func (p *PdfDictionaryObj) AddCompositeGlyphs(glyphArray *[]int, glyph int)
add composite glyph composite glyph is a Unicode entity that can be defined as a sequence of one or more other characters.
func (*PdfDictionaryObj) Build ¶
func (p *PdfDictionaryObj) Build() error
func (*PdfDictionaryObj) GetObjBuff ¶
func (p *PdfDictionaryObj) GetObjBuff() *bytes.Buffer
func (*PdfDictionaryObj) GetOffset ¶
func (p *PdfDictionaryObj) GetOffset(glyph int) int
func (*PdfDictionaryObj) GetType ¶
func (p *PdfDictionaryObj) GetType() string
func (*PdfDictionaryObj) Init ¶
func (p *PdfDictionaryObj) Init(funcGetRoot func() *GoPdf)
func (*PdfDictionaryObj) SetPtrToSubsetFontObj ¶
func (p *PdfDictionaryObj) SetPtrToSubsetFontObj(ptr *SubsetFontObj)
type ProcSetObj ¶
type ProcSetObj struct { //Font Realtes RelateFonts RealteXobjs RealteXobjects // contains filtered or unexported fields }
func (*ProcSetObj) Build ¶
func (me *ProcSetObj) Build() error
func (*ProcSetObj) GetObjBuff ¶
func (me *ProcSetObj) GetObjBuff() *bytes.Buffer
func (*ProcSetObj) GetType ¶
func (me *ProcSetObj) GetType() string
func (*ProcSetObj) Init ¶
func (me *ProcSetObj) Init(funcGetRoot func() *GoPdf)
type RealteXobject ¶
type RealteXobject struct {
IndexOfObj int
}
type RealteXobjects ¶
type RealteXobjects []RealteXobject
type RelateFont ¶
type RelateFonts ¶
type RelateFonts []RelateFont
func (*RelateFonts) IsContainsFamily ¶
func (me *RelateFonts) IsContainsFamily(family string) bool
type SubfontDescriptorObj ¶
type SubfontDescriptorObj struct { PtrToSubsetFontObj *SubsetFontObj // contains filtered or unexported fields }
func (*SubfontDescriptorObj) Build ¶
func (s *SubfontDescriptorObj) Build() error
func (*SubfontDescriptorObj) GetObjBuff ¶
func (s *SubfontDescriptorObj) GetObjBuff() *bytes.Buffer
func (*SubfontDescriptorObj) GetType ¶
func (s *SubfontDescriptorObj) GetType() string
func (*SubfontDescriptorObj) Init ¶
func (s *SubfontDescriptorObj) Init(func() *GoPdf)
func (*SubfontDescriptorObj) SetIndexObjPdfDictionary ¶
func (s *SubfontDescriptorObj) SetIndexObjPdfDictionary(index int)
func (*SubfontDescriptorObj) SetPtrToSubsetFontObj ¶
func (s *SubfontDescriptorObj) SetPtrToSubsetFontObj(ptr *SubsetFontObj)
type SubsetFontObj ¶
type SubsetFontObj struct { Family string CharacterToGlyphIndex map[rune]uint64 CountOfFont int // contains filtered or unexported fields }
PdfType0 Font
func (*SubsetFontObj) AddChars ¶
func (s *SubsetFontObj) AddChars(txt string)
func (*SubsetFontObj) Build ¶
func (s *SubsetFontObj) Build() error
func (*SubsetFontObj) CharCodeToGlyphIndex ¶
func (s *SubsetFontObj) CharCodeToGlyphIndex(r rune) uint64
func (*SubsetFontObj) GetFamily ¶
func (s *SubsetFontObj) GetFamily() string
func (*SubsetFontObj) GetObjBuff ¶
func (s *SubsetFontObj) GetObjBuff() *bytes.Buffer
func (*SubsetFontObj) GetTTFParser ¶
func (s *SubsetFontObj) GetTTFParser() *core.TTFParser
func (*SubsetFontObj) GetType ¶
func (s *SubsetFontObj) GetType() string
func (*SubsetFontObj) GetUt ¶
func (s *SubsetFontObj) GetUt() int64
func (*SubsetFontObj) GlyphIndexToPdfWidth ¶
func (s *SubsetFontObj) GlyphIndexToPdfWidth(glyphIndex uint64) uint64
func (*SubsetFontObj) Init ¶
func (s *SubsetFontObj) Init(funcGetRoot func() *GoPdf)
func (*SubsetFontObj) SetFamily ¶
func (s *SubsetFontObj) SetFamily(familyname string)
func (*SubsetFontObj) SetIndexObjCIDFont ¶
func (s *SubsetFontObj) SetIndexObjCIDFont(index int)
func (*SubsetFontObj) SetIndexObjUnicodeMap ¶
func (s *SubsetFontObj) SetIndexObjUnicodeMap(index int)
func (*SubsetFontObj) SetTTFByPath ¶
func (s *SubsetFontObj) SetTTFByPath(ttfpath string) error
type UnicodeMap ¶
type UnicodeMap struct { PtrToSubsetFontObj *SubsetFontObj // contains filtered or unexported fields }
func (*UnicodeMap) Build ¶
func (u *UnicodeMap) Build() error
func (*UnicodeMap) GetObjBuff ¶
func (u *UnicodeMap) GetObjBuff() *bytes.Buffer
func (*UnicodeMap) GetType ¶
func (u *UnicodeMap) GetType() string
func (*UnicodeMap) Init ¶
func (u *UnicodeMap) Init(funcGetRoot func() *GoPdf)
func (*UnicodeMap) SetPtrToSubsetFontObj ¶
func (u *UnicodeMap) SetPtrToSubsetFontObj(ptr *SubsetFontObj)
Source Files ¶
- basic_obj.go
- buff.go
- buff_write.go
- catalog_obj.go
- cid_font_obj.go
- config.go
- content_obj.go
- current.go
- debug.go
- debug_ch.go
- debug_th.go
- embedfont_obj.go
- encoding_obj.go
- font_obj.go
- fontconverthelper.go
- fontdescriptor_obj.go
- gopdf.go
- ifont.go
- image_obj.go
- iobj.go
- isubset.go
- page_obj.go
- pages_obj.go
- pdf_dictionary_obj.go
- procset_obj.go
- rect.go
- strhelper.go
- subfont_descriptor_obj.go
- subset_font_obj.go
- unicode_map.go