Documentation ¶
Index ¶
- Constants
- Variables
- func CheckSum(data []byte) uint
- func ContentObjCalTextHeight(fontsize int) float64
- func CreateEmbeddedFontSubsetName(name string) string
- func DesignUnitsToPdf(val int, unitsPerEm uint) int
- func FontConvertHelperCw2Str(cw FontCw) string
- func FontConvertHelper_Cw2Str(cw FontCw) string
- func GetBuffer() *bytes.Buffer
- func ImgReactagleToWH(imageRect image.Rectangle) (float64, float64)
- func PointsToUnits(t int, u float64) float64
- func PointsToUnitsVar(t int, u ...*float64)
- func PutBuffer(buf *bytes.Buffer)
- 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 UnitsToPoints(t int, u float64) float64
- func UnitsToPointsVar(t int, u ...*float64)
- 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 Box
- type Buff
- type CIDFontObj
- type CacheContent
- type CatalogObj
- type CellOption
- type Config
- type ContentObj
- func (c *ContentObj) AppendStreamCurve(x0 float64, y0 float64, x1 float64, y1 float64, x2 float64, y2 float64, ...)
- func (c *ContentObj) AppendStreamImage(index int, x float64, y float64, rect *Rect)
- func (c *ContentObj) AppendStreamImportedTemplate(tplName string, scaleX float64, scaleY float64, tX float64, tY float64)
- 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) AppendStreamPolygon(points []Point, style string)
- func (c *ContentObj) AppendStreamRectangle(x float64, y float64, wdth float64, hght float64, style string)
- func (c *ContentObj) AppendStreamSetColorFill(r uint8, g uint8, b uint8)
- func (c *ContentObj) AppendStreamSetColorStroke(r uint8, g uint8, b uint8)
- func (c *ContentObj) AppendStreamSetGrayFill(w float64)
- func (c *ContentObj) AppendStreamSetGrayStroke(w float64)
- func (c *ContentObj) AppendStreamSetLineType(t string)
- func (c *ContentObj) AppendStreamSetLineWidth(w float64)
- func (c *ContentObj) AppendStreamSubsetFont(rectangle *Rect, text string, cellOpt CellOption) error
- func (c *ContentObj) AppendStreamText(text string) error
- type Current
- type DeviceRGBObj
- type EmbedFontObj
- type EncodingObj
- type EncryptionObj
- type ExtGS
- type ExtGStateObj
- type FontCw
- type FontDescItem
- type FontDescriptorObj
- type FontObj
- type FuncKernOverride
- type GoPdf2
- func (gp *GoPdf2) AddExternalLink(url string, x, y, w, h float64)
- func (gp *GoPdf2) AddInternalLink(anchor string, x, y, w, h float64)
- func (gp *GoPdf2) AddOutline(title string)
- func (gp *GoPdf2) AddPage()
- func (gp *GoPdf2) AddPageWithOption(opt PageOption)
- func (gp *GoPdf2) AddTTFFont(family string, ttfpath string) error
- func (gp *GoPdf2) AddTTFFontByReader(family string, rd io.Reader) error
- func (gp *GoPdf2) AddTTFFontByReaderWithOption(family string, rd io.Reader, option TtfOption) error
- func (gp *GoPdf2) AddTTFFontWithOption(family string, ttfpath string, option TtfOption) error
- func (gp *GoPdf2) Br(h float64)
- func (gp *GoPdf2) Cell(rectangle *Rect, text string) error
- func (gp *GoPdf2) CellWithOption(rectangle *Rect, text string, opt CellOption) error
- func (gp *GoPdf2) Close() error
- func (gp *GoPdf2) Curve(x0 float64, y0 float64, x1 float64, y1 float64, x2 float64, y2 float64, ...)
- func (gp *GoPdf2) GetBytesPdf() []byte
- func (gp *GoPdf2) GetBytesPdfReturnErr() ([]byte, error)
- func (gp *GoPdf2) GetNextObjectID() int
- func (gp *GoPdf2) GetX() float64
- func (gp *GoPdf2) GetY() float64
- func (gp *GoPdf2) Image(picPath string, x float64, y float64, rect *Rect) error
- func (gp *GoPdf2) ImageByHolder(img ImageHolder, x float64, y float64, rect *Rect) error
- func (gp *GoPdf2) ImportObjects(objs map[int]string, startObjID int)
- func (gp *GoPdf2) ImportPage(sourceFile string, pageno int, box string) int
- func (gp *GoPdf2) ImportPageStream(sourceStream *io.ReadSeeker, pageno int, box string) int
- func (gp *GoPdf2) ImportTemplates(tpls map[string]int)
- func (gp *GoPdf2) IsCurrFontContainGlyph(r rune) (bool, error)
- func (gp *GoPdf2) KernOverride(family string, fn FuncKernOverride) error
- func (gp *GoPdf2) Line(x1 float64, y1 float64, x2 float64, y2 float64)
- func (gp *GoPdf2) MarginBottom() float64
- func (gp *GoPdf2) MarginLeft() float64
- func (gp *GoPdf2) MarginRight() float64
- func (gp *GoPdf2) MarginTop() float64
- func (gp *GoPdf2) Margins() (float64, float64, float64, float64)
- func (gp *GoPdf2) MeasureTextWidth(text string) (float64, error)
- func (gp *GoPdf2) MultiCell(rectangle *Rect, text string) error
- func (gp *GoPdf2) Oval(x1 float64, y1 float64, x2 float64, y2 float64)
- func (gp *GoPdf2) PointsToUnits(u float64) float64
- func (gp *GoPdf2) PointsToUnitsVar(u ...*float64)
- func (gp *GoPdf2) Polygon(points []Point, style string)
- func (gp *GoPdf2) Read(p []byte) (int, error)
- func (gp *GoPdf2) RectFromLowerLeft(x float64, y float64, wdth float64, hght float64)
- func (gp *GoPdf2) RectFromLowerLeftWithStyle(x float64, y float64, wdth float64, hght float64, style string)
- func (gp *GoPdf2) RectFromUpperLeft(x float64, y float64, wdth float64, hght float64)
- func (gp *GoPdf2) RectFromUpperLeftWithStyle(x float64, y float64, wdth float64, hght float64, style string)
- func (gp *GoPdf2) Rotate(angle, x, y float64)
- func (gp *GoPdf2) RotateReset()
- func (gp *GoPdf2) SetAlpha(alpha float64, blendModeStr string) error
- func (gp *GoPdf2) SetAnchor(name string)
- func (gp *GoPdf2) SetCompressLevel(level int)
- func (gp *GoPdf2) SetFillColor(r uint8, g uint8, b uint8)
- func (gp *GoPdf2) SetFont(family string, style string, size int) error
- func (gp *GoPdf2) SetFontWithStyle(family string, style int, size int) error
- func (gp *GoPdf2) SetGrayFill(grayScale float64)
- func (gp *GoPdf2) SetGrayStroke(grayScale float64)
- func (gp *GoPdf2) SetInfo(info PdfInfo)
- func (gp *GoPdf2) SetLeftMargin(margin float64)
- func (gp *GoPdf2) SetLineType(linetype string)
- func (gp *GoPdf2) SetLineWidth(width float64)
- func (gp *GoPdf2) SetMarginBottom(margin float64)
- func (gp *GoPdf2) SetMarginLeft(margin float64)
- func (gp *GoPdf2) SetMarginRight(margin float64)
- func (gp *GoPdf2) SetMarginTop(margin float64)
- func (gp *GoPdf2) SetMargins(left, top, right, bottom float64)
- func (gp *GoPdf2) SetNoCompression()
- func (gp *GoPdf2) SetStrokeColor(r uint8, g uint8, b uint8)
- func (gp *GoPdf2) SetTextColor(r uint8, g uint8, b uint8)
- func (gp *GoPdf2) SetTopMargin(margin float64)
- func (gp *GoPdf2) SetX(x float64)
- func (gp *GoPdf2) SetY(y float64)
- func (gp *GoPdf2) SplitText(text string, width float64) ([]string, error)
- func (gp *GoPdf2) Start(config Config)
- func (gp *GoPdf2) Text(text string) error
- func (gp *GoPdf2) UnitsToPoints(u float64) float64
- func (gp *GoPdf2) UnitsToPointsVar(u ...*float64)
- func (gp *GoPdf2) UseImportedTemplate(tplid int, x float64, y float64, w float64, h float64)
- func (gp *GoPdf2) Write(w io.Writer) error
- func (gp *GoPdf2) WritePdf(pdfPath string) error
- type IFont
- type IObj
- type ImageCache
- type ImageHolder
- type ImageObj
- type ImportedObj
- type MapOfCharacterToGlyphIndex
- func (m *MapOfCharacterToGlyphIndex) AllKeys() []rune
- func (m *MapOfCharacterToGlyphIndex) AllVals() []uint
- func (m *MapOfCharacterToGlyphIndex) Index(k rune) (int, bool)
- func (m *MapOfCharacterToGlyphIndex) KeyExists(k rune) bool
- func (m *MapOfCharacterToGlyphIndex) Set(k rune, v uint)
- func (m *MapOfCharacterToGlyphIndex) Val(k rune) (uint, bool)
- type Margins
- type OutlineObj
- type OutlinesObj
- type PDFProtection
- type PDFProtectionConfig
- type PageObj
- type PageOption
- type PagesObj
- type PdfDictionaryObj
- type PdfInfo
- type Point
- type ProcSetObj
- type Rect
- type RelateFont
- type RelateFonts
- type RelateXobject
- type RelateXobjects
- type Rgb
- type SMask
- type SubfontDescriptorObj
- type SubsetFontObj
- func (s *SubsetFontObj) AddChars(txt string) error
- func (s *SubsetFontObj) CharCodeToGlyphIndex(r rune) (uint, error)
- func (s *SubsetFontObj) CharIndex(r rune) (uint, error)
- func (s *SubsetFontObj) CharWidth(r rune) (uint, error)
- func (s *SubsetFontObj) GetFamily() string
- func (s *SubsetFontObj) GetTTFParser() *core.TTFParser
- func (s *SubsetFontObj) GetTtfFontOption() TtfOption
- func (s *SubsetFontObj) GetUp() int
- func (s *SubsetFontObj) GetUt() int
- func (s *SubsetFontObj) GlyphIndexToPdfWidth(glyphIndex uint) uint
- func (s *SubsetFontObj) KernValueByLeft(left uint) (bool, *core.KernValue)
- 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
- func (s *SubsetFontObj) SetTTFByReader(rd io.Reader) error
- func (s *SubsetFontObj) SetTtfFontOption(option TtfOption)
- type Transparency
- type TtfOption
- type UnicodeMap
Constants ¶
const ( UnitUnset = iota // No units were set, when conversion is called on nothing will happen UnitPT // Points UnitMM // Millimeters UnitCM // centimeters UnitIN // inches )
The units that can be used in the document
const ( Unit_Unset = UnitUnset // No units were set, when conversion is called on nothing will happen Unit_PT = UnitPT // Points Unit_MM = UnitMM // Millimeters Unit_CM = UnitCM // centimeters Unit_IN = UnitIN // inches )
The units that can be used in the document (for backward compatibility) Deprecated: Use UnitUnset,UnitPT,UnitMM,UnitCM,UnitIN instead
const ( //PermissionsPrint setProtection print PermissionsPrint = 4 //PermissionsModify setProtection modify PermissionsModify = 8 //PermissionsCopy setProtection copy PermissionsCopy = 16 //PermissionsAnnotForms setProtection annot-forms PermissionsAnnotForms = 32 )
const AllBorders = 15 //001111
AllBorders allborders
const Bold = 2 //000010
Bold - font style bold
const Bottom = 1 //000001
Bottom bottom
const Center = 16 //010000
Center center
const ContentTypeCell = 0
ContentTypeCell cell
const ContentTypeText = 1
ContentTypeText text
const Italic = 1 //000001
Italic - font style italic
const Left = 8 //001000
Left left
const Middle = 32 //100000
Middle middle
const Regular = 0 //000000
Regular - font style regular
const Right = 2 //000010
Right right
const Top = 4 //000100
Top top
const Underline = 4 //000100
Underline - font style underline
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,
}
EntrySelectors entry selectors
var ErrCharNotFound = errors.New("char not found")
ErrCharNotFound char not found
var ErrNotSupportShortIndexYet = errors.New("not suport none short index yet")
ErrNotSupportShortIndexYet not suport none short index yet
var PageSize10x14 = &Rect{W: 720, H: 1008, unitOverride: UnitPT}
PageSize10x14 page format
var PageSizeA0 = &Rect{W: 2384, H: 3371, unitOverride: UnitPT}
PageSizeA0 page format
var PageSizeA1 = &Rect{W: 1685, H: 2384, unitOverride: UnitPT}
PageSizeA1 page format
var PageSizeA2 = &Rect{W: 1190, H: 1684, unitOverride: UnitPT}
PageSizeA2 page format
var PageSizeA3 = &Rect{W: 842, H: 1190, unitOverride: UnitPT}
PageSizeA3 page format
var PageSizeA4 = &Rect{W: 595, H: 842, unitOverride: UnitPT}
PageSizeA4 page format
var PageSizeA4Small = &Rect{W: 595, H: 842, unitOverride: UnitPT}
PageSizeA4Small page format
var PageSizeA5 = &Rect{W: 420, H: 595, unitOverride: UnitPT}
PageSizeA5 page format
var PageSizeB4 = &Rect{W: 729, H: 1032, unitOverride: UnitPT}
PageSizeB4 page format
var PageSizeB5 = &Rect{W: 516, H: 729, unitOverride: UnitPT}
PageSizeB5 page format
var PageSizeExecutive = &Rect{W: 540, H: 720, unitOverride: UnitPT}
PageSizeExecutive page format
var PageSizeFolio = &Rect{W: 612, H: 936, unitOverride: UnitPT}
PageSizeFolio page format
var PageSizeLedger = &Rect{W: 1224, H: 792, unitOverride: UnitPT}
PageSizeLedger page format
var PageSizeLegal = &Rect{W: 612, H: 1008, unitOverride: UnitPT}
PageSizeLegal page format
var PageSizeLetter = &Rect{W: 612, H: 792, unitOverride: UnitPT}
PageSizeLetter page format
var PageSizeLetterSmall = &Rect{W: 612, H: 792, unitOverride: UnitPT}
PageSizeLetterSmall page format
var PageSizeQuarto = &Rect{W: 610, H: 780, unitOverride: UnitPT}
PageSizeQuarto page format
var PageSizeStatement = &Rect{W: 396, H: 612, unitOverride: UnitPT}
PageSizeStatement page format
var PageSizeTabloid = &Rect{W: 792, H: 1224, unitOverride: UnitPT}
PageSizeTabloid page format
Functions ¶
func ContentObjCalTextHeight ¶
ContentObjCalTextHeight calculates height of text.
func CreateEmbeddedFontSubsetName ¶
CreateEmbeddedFontSubsetName create Embedded font (subset font) name
func DesignUnitsToPdf ¶
DesignUnitsToPdf convert unit
func FontConvertHelperCw2Str ¶
FontConvertHelperCw2Str converts main ASCII characters of a FontCW to a string.
func FontConvertHelper_Cw2Str ¶
FontConvertHelper_Cw2Str converts main ASCII characters of a FontCW to a string. (for backward compatibility) Deprecated: Use FontConvertHelperCw2Str(cw FontCw) instead
func ImgReactagleToWH ¶
ImgReactagleToWH Rectangle to W and H
func PointsToUnits ¶
PointsToUnits converts points to the provided units
func PointsToUnitsVar ¶
PointsToUnitsVar converts points to the provided units for all variables supplied
func ReadShortFromByte ¶
ReadShortFromByte read short from byte array
func ReadUShortFromByte ¶
ReadUShortFromByte read ushort from byte array
func StrHelperGetStringWidth ¶
StrHelperGetStringWidth get string width
func UnitsToPoints ¶
UnitsToPoints converts units of the provided type to points
func UnitsToPointsVar ¶
UnitsToPointsVar converts units of the provided type to points for all variables supplied
func WriteBytes ¶
WriteBytes writes []byte value to w io.Writer
func WriteUInt16 ¶
WriteUInt16 writes a 16-bit unsigned integer value to w io.Writer
Types ¶
type Box ¶
type Box struct {
Left, Top, Right, Bottom float64
// contains filtered or unexported fields
}
func (*Box) UnitsToPoints ¶
UnitsToPoints converts the box coordinates to Points. When this is called it is assumed the values of the box are in Units
type CIDFontObj ¶
type CIDFontObj struct { PtrToSubsetFontObj *SubsetFontObj // contains filtered or unexported fields }
CIDFontObj is a CID-keyed font. cf. https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5014.CIDFont_Spec.pdf
func (*CIDFontObj) SetIndexObjSubfontDescriptor ¶
func (ci *CIDFontObj) SetIndexObjSubfontDescriptor(index int)
SetIndexObjSubfontDescriptor set indexObjSubfontDescriptor
func (*CIDFontObj) SetPtrToSubsetFontObj ¶
func (ci *CIDFontObj) SetPtrToSubsetFontObj(ptr *SubsetFontObj)
SetPtrToSubsetFontObj set PtrToSubsetFontObj
type CacheContent ¶
type CacheContent struct {
// contains filtered or unexported fields
}
CacheContent Export cacheContent
func (*CacheContent) Setup ¶
func (c *CacheContent) Setup(rectangle *Rect, textColor Rgb, grayFill float64, fontCountIndex int, fontSize int, fontStyle int, setXCount int, x, y float64, fontSubset *SubsetFontObj, pageheight float64, contentType int, cellOpt CellOption, lineWidth float64, )
Setup setup all infomation for cacheContent
func (*CacheContent) WriteTextToContent ¶
func (c *CacheContent) WriteTextToContent(text string)
WriteTextToContent write text to content
type CatalogObj ¶
type CatalogObj struct {
// contains filtered or unexported fields
}
CatalogObj : catalog dictionary
func (*CatalogObj) SetIndexObjOutlines ¶
func (c *CatalogObj) SetIndexObjOutlines(index int)
type CellOption ¶
type CellOption struct { Align int //Allows to align the text. Possible values are: Left,Center,Right,Top,Bottom,Middle Border int //Indicates if borders must be drawn around the cell. Possible values are: Left, Top, Right, Bottom, AllBorders Float int //Indicates where the current position should go after the call. Possible values are: Right, Bottom }
CellOption cell option
type Config ¶
type Config struct { Unit int // The unit type to use when composing the document. TrimBox Box // The default trim box for all pages in the document PageSize Rect // The default page size for all pages in the document K float64 // Not sure Protection PDFProtectionConfig // Protection settings }
Config static config
type ContentObj ¶
type ContentObj struct {
// contains filtered or unexported fields
}
ContentObj content object
func (*ContentObj) AppendStreamCurve ¶
func (c *ContentObj) AppendStreamCurve(x0 float64, y0 float64, x1 float64, y1 float64, x2 float64, y2 float64, x3 float64, y3 float64, style string)
AppendStreamCurve draw curve
- x0, y0: Start point
- x1, y1: Control point 1
- x2, y2: Control point 2
- x3, y3: End point
- style: Style of rectangule (draw and/or fill: D, F, DF, FD) D or empty string: draw. This is the default value. F: fill DF or FD: draw and fill
func (*ContentObj) AppendStreamImage ¶
func (c *ContentObj) AppendStreamImage(index int, x float64, y float64, rect *Rect)
AppendStreamImage append image
func (*ContentObj) AppendStreamImportedTemplate ¶
func (c *ContentObj) AppendStreamImportedTemplate(tplName string, scaleX float64, scaleY float64, tX float64, tY float64)
AppendStreamImportedTemplate append imported template
func (*ContentObj) AppendStreamLine ¶
func (c *ContentObj) AppendStreamLine(x1 float64, y1 float64, x2 float64, y2 float64)
AppendStreamLine append line
func (*ContentObj) AppendStreamOval ¶
func (c *ContentObj) AppendStreamOval(x1 float64, y1 float64, x2 float64, y2 float64)
AppendStreamOval append oval
func (*ContentObj) AppendStreamPolygon ¶
func (c *ContentObj) AppendStreamPolygon(points []Point, style string)
AppendStreamPolygon append polygon
func (*ContentObj) AppendStreamRectangle ¶
func (c *ContentObj) AppendStreamRectangle(x float64, y float64, wdth float64, hght float64, style string)
AppendStreamRectangle : draw rectangle from lower-left corner (x, y) with specif width/height
func (*ContentObj) AppendStreamSetColorFill ¶
func (c *ContentObj) AppendStreamSetColorFill(r uint8, g uint8, b uint8)
AppendStreamSetColorFill set the color fill
func (*ContentObj) AppendStreamSetColorStroke ¶
func (c *ContentObj) AppendStreamSetColorStroke(r uint8, g uint8, b uint8)
AppendStreamSetColorStroke set the color stroke
func (*ContentObj) AppendStreamSetGrayFill ¶
func (c *ContentObj) AppendStreamSetGrayFill(w float64)
AppendStreamSetGrayFill set the grayscale fills
func (*ContentObj) AppendStreamSetGrayStroke ¶
func (c *ContentObj) AppendStreamSetGrayStroke(w float64)
AppendStreamSetGrayStroke set the grayscale stroke
func (*ContentObj) AppendStreamSetLineType ¶
func (c *ContentObj) AppendStreamSetLineType(t string)
AppendStreamSetLineType : Set linetype [solid, dashed, dotted]
func (*ContentObj) AppendStreamSetLineWidth ¶
func (c *ContentObj) AppendStreamSetLineWidth(w float64)
AppendStreamSetLineWidth : set line width
func (*ContentObj) AppendStreamSubsetFont ¶
func (c *ContentObj) AppendStreamSubsetFont(rectangle *Rect, text string, cellOpt CellOption) error
AppendStreamSubsetFont add stream of text
func (*ContentObj) AppendStreamText ¶
func (c *ContentObj) AppendStreamText(text string) error
AppendStreamText append text
type Current ¶
type Current struct { X float64 Y float64 //font IndexOfFontObj int CountOfFont int CountOfL int FontSize int FontStyle int // Regular|Bold|Italic|Underline FontFontCount int FontType int // CURRENT_FONT_TYPE_IFONT or CURRENT_FONT_TYPE_SUBSET FontISubset *SubsetFontObj // FontType == CURRENT_FONT_TYPE_SUBSET //page IndexOfPageObj int //img CountOfImg int //cache of image in pdf file ImgCaches []ImageCache // contains filtered or unexported fields }
Current current state
type DeviceRGBObj ¶
type DeviceRGBObj struct {
// contains filtered or unexported fields
}
DeviceRGBObj DeviceRGB
type EmbedFontObj ¶
type EmbedFontObj struct { Data string // contains filtered or unexported fields }
EmbedFontObj is an embedded font object.
func (*EmbedFontObj) SetFont ¶
func (e *EmbedFontObj) SetFont(font IFont, zfontpath string)
SetFont sets the font of an embedded font object.
type EncodingObj ¶
type EncodingObj struct {
// contains filtered or unexported fields
}
EncodingObj is a font object.
func (*EncodingObj) GetFont ¶
func (e *EncodingObj) GetFont() IFont
GetFont gets the font from an encoding object.
func (*EncodingObj) SetFont ¶
func (e *EncodingObj) SetFont(font IFont)
SetFont sets the font of an encoding object.
type EncryptionObj ¶
type EncryptionObj struct {
// contains filtered or unexported fields
}
EncryptionObj encryption object res
type ExtGStateObj ¶
ExtGStateObj is the graphics state parameter dictionary. TODO: add all fields https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf 8.4.5 page 128
type FontDescItem ¶
FontDescItem is a (key, value) pair.
type FontDescriptorObj ¶
type FontDescriptorObj struct {
// contains filtered or unexported fields
}
FontDescriptorObj is a font descriptor object.
func (*FontDescriptorObj) GetFont ¶
func (f *FontDescriptorObj) GetFont() IFont
GetFont gets font from descriptor.
func (*FontDescriptorObj) SetFont ¶
func (f *FontDescriptorObj) SetFont(font IFont)
SetFont sets the font in descriptor.
func (*FontDescriptorObj) SetFontFileObjRelate ¶
func (f *FontDescriptorObj) SetFontFileObjRelate(relate string)
SetFontFileObjRelate ???
type FontObj ¶
type FontObj struct { Family string //Style string //Size int IsEmbedFont bool Font IFont CountOfFont int // contains filtered or unexported fields }
FontObj font obj
func (*FontObj) SetIndexObjEncoding ¶
SetIndexObjEncoding sets the encoding.
func (*FontObj) SetIndexObjFontDescriptor ¶
SetIndexObjFontDescriptor sets the font descriptor.
func (*FontObj) SetIndexObjWidth ¶
SetIndexObjWidth sets the width of a font object.
type FuncKernOverride ¶
type FuncKernOverride func( leftRune rune, rightRune rune, leftPair uint, rightPair uint, pairVal int16, ) int16
FuncKernOverride return your custome pair value
type GoPdf2 ¶
type GoPdf2 struct {
// contains filtered or unexported fields
}
GoPdf2 : A simple library for generating PDF written in Go lang
func (*GoPdf2) AddExternalLink ¶
AddExternalLink adds a new external link.
func (*GoPdf2) AddInternalLink ¶
AddInternalLink adds a new internal link.
func (*GoPdf2) AddOutline ¶
func (*GoPdf2) AddPageWithOption ¶
func (gp *GoPdf2) AddPageWithOption(opt PageOption)
AddPageWithOption : add new page with option
func (*GoPdf2) AddTTFFont ¶
AddTTFFont : add font file
func (*GoPdf2) AddTTFFontByReader ¶
AddTTFFontByReader add font file
func (*GoPdf2) AddTTFFontByReaderWithOption ¶
AddTTFFontByReaderWithOption add font file
func (*GoPdf2) AddTTFFontWithOption ¶
AddTTFFontWithOption : add font file
func (*GoPdf2) Cell ¶
Cell : create cell of text ( use current x,y is upper-left corner of cell) Note that this has no effect on Rect.H pdf (now). Fix later :-)
func (*GoPdf2) CellWithOption ¶
func (gp *GoPdf2) CellWithOption(rectangle *Rect, text string, opt CellOption) error
CellWithOption create cell of text ( use current x,y is upper-left corner of cell)
func (*GoPdf2) Curve ¶
func (gp *GoPdf2) Curve(x0 float64, y0 float64, x1 float64, y1 float64, x2 float64, y2 float64, x3 float64, y3 float64, style string)
Curve Draws a Bézier curve (the Bézier curve is tangent to the line between the control points at either end of the curve) Parameters: - x0, y0: Start point - x1, y1: Control point 1 - x2, y2: Control point 2 - x3, y3: End point - style: Style of rectangule (draw and/or fill: D, F, DF, FD)
func (*GoPdf2) GetBytesPdf ¶
GetBytesPdf : get bytes of pdf file
func (*GoPdf2) GetBytesPdfReturnErr ¶
GetBytesPdfReturnErr : get bytes of pdf file
func (*GoPdf2) GetNextObjectID ¶
GetNextObjectID gets the next object ID so that gofpdi knows where to start the object IDs.
func (*GoPdf2) ImageByHolder ¶
ImageByHolder : draw image by ImageHolder
func (*GoPdf2) ImportObjects ¶
ImportObjects imports objects from gofpdi into current document.
func (*GoPdf2) ImportPage ¶
ImportPage imports a page and return template id. gofpdi code
func (*GoPdf2) ImportPageStream ¶
ImportPageStream imports page using a stream. Return template id after importing. gofpdi code
func (*GoPdf2) ImportTemplates ¶
ImportTemplates names into procset dictionary.
func (*GoPdf2) IsCurrFontContainGlyph ¶
IsCurrFontContainGlyph defines is current font contains to a glyph r: any rune
func (*GoPdf2) KernOverride ¶
func (gp *GoPdf2) KernOverride(family string, fn FuncKernOverride) error
KernOverride override kern value
func (*GoPdf2) MarginBottom ¶
MarginBottom returns the bottom margin.
func (*GoPdf2) MarginLeft ¶
MarginLeft returns the left margin.
func (*GoPdf2) MarginRight ¶
MarginRight returns the right margin.
func (*GoPdf2) Margins ¶
Margins gets the current margins, The margins will be converted back to the documents units. Returned values will be in the following order Left, Top, Right, Bottom
func (*GoPdf2) MeasureTextWidth ¶
MeasureTextWidth : measure Width of text (use current font)
func (*GoPdf2) MultiCell ¶
MultiCell : create of text with line breaks ( use current x,y is upper-left corner of cell)
func (*GoPdf2) PointsToUnits ¶
PointsToUnits converts the points to the documents unit type
func (*GoPdf2) PointsToUnitsVar ¶
PointsToUnitsVar converts the points to the documents unit type for all variables passed in
func (*GoPdf2) Polygon ¶
Polygon : draw polygon
- style: Style of polygon (draw and/or fill: D, F, DF, FD) D or empty string: draw. This is the default value. F: fill DF or FD: draw and fill
Usage:
pdf.SetStrokeColor(255, 0, 0) pdf.SetLineWidth(2) pdf.SetFillColor(0, 255, 0) pdf.Polygon([]gopdf.Point{{X: 10, Y: 30}, {X: 585, Y: 200}, {X: 585, Y: 250}}, "DF")
func (*GoPdf2) RectFromLowerLeft ¶
RectFromLowerLeft : draw rectangle from lower-left corner (x, y)
func (*GoPdf2) RectFromLowerLeftWithStyle ¶
func (gp *GoPdf2) RectFromLowerLeftWithStyle(x float64, y float64, wdth float64, hght float64, style string)
RectFromLowerLeftWithStyle : draw rectangle from lower-left corner (x, y)
- style: Style of rectangule (draw and/or fill: D, F, DF, FD) D or empty string: draw. This is the default value. F: fill DF or FD: draw and fill
func (*GoPdf2) RectFromUpperLeft ¶
RectFromUpperLeft : draw rectangle from upper-left corner (x, y)
func (*GoPdf2) RectFromUpperLeftWithStyle ¶
func (gp *GoPdf2) RectFromUpperLeftWithStyle(x float64, y float64, wdth float64, hght float64, style string)
RectFromUpperLeftWithStyle : draw rectangle from upper-left corner (x, y)
- style: Style of rectangule (draw and/or fill: D, F, DF, FD) D or empty string: draw. This is the default value. F: fill DF or FD: draw and fill
func (*GoPdf2) Rotate ¶
Rotate rotate text or image angle is angle in degrees. x, y is rotation center
func (*GoPdf2) SetAlpha ¶
SetAlpha sets transparency. alpha: value from 0 (transparent) to 1 (opaque) blendMode: blend mode, one of the following:
Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight, SoftLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity
func (*GoPdf2) SetCompressLevel ¶
SetCompressLevel : set compress Level for content streams Possible values for level:
-2 HuffmanOnly, -1 DefaultCompression (which is level 6) 0 No compression, 1 fastest compression, but not very good ratio 9 best compression, but slowest
func (*GoPdf2) SetFillColor ¶
SetFillColor set the color for the stroke
func (*GoPdf2) SetFont ¶
SetFont : set font style support "" or "U" for "B" and "I" should be loaded apropriate fonts with same styles defined
func (*GoPdf2) SetFontWithStyle ¶
SetFontWithStyle : set font style support Regular or Underline for Bold|Italic should be loaded apropriate fonts with same styles defined
func (*GoPdf2) SetGrayFill ¶
SetGrayFill set the grayscale for the fill, takes a float64 between 0.0 and 1.0
func (*GoPdf2) SetGrayStroke ¶
SetGrayStroke set the grayscale for the stroke, takes a float64 between 0.0 and 1.0
func (*GoPdf2) SetLeftMargin ¶
SetLeftMargin sets left margin.
func (*GoPdf2) SetLineType ¶
SetLineType : set line type ("dashed" ,"dotted")
Usage: pdf.SetLineType("dashed") pdf.Line(50, 200, 550, 200) pdf.SetLineType("dotted") pdf.Line(50, 400, 550, 400)
func (*GoPdf2) SetLineWidth ¶
SetLineWidth : set line width
func (*GoPdf2) SetMarginBottom ¶
SetMarginBottom set the bottom margin
func (*GoPdf2) SetMarginLeft ¶
SetMarginLeft sets the left margin
func (*GoPdf2) SetMarginRight ¶
SetMarginRight sets the right margin
func (*GoPdf2) SetMarginTop ¶
SetMarginTop sets the top margin
func (*GoPdf2) SetMargins ¶
SetMargins defines the left, top, right and bottom margins. By default, they equal 1 cm. Call this method to change them.
func (*GoPdf2) SetNoCompression ¶
func (gp *GoPdf2) SetNoCompression()
SetNoCompression : compressLevel = 0
func (*GoPdf2) SetStrokeColor ¶
SetStrokeColor set the color for the stroke
func (*GoPdf2) SetTextColor ¶
SetTextColor : function sets the text color
func (*GoPdf2) SetTopMargin ¶
SetTopMargin sets top margin.
func (*GoPdf2) UnitsToPoints ¶
UnitsToPoints converts the units to the documents unit type
func (*GoPdf2) UnitsToPointsVar ¶
UnitsToPointsVar converts the units to the documents unit type for all variables passed in
func (*GoPdf2) UseImportedTemplate ¶
UseImportedTemplate draws an imported PDF page.
type IFont ¶
type IFont interface { Init() GetType() string GetName() string GetDesc() []FontDescItem GetUp() int GetUt() int GetCw() FontCw GetEnc() string GetDiff() string GetOriginalsize() int SetFamily(family string) GetFamily() string }
IFont represents a font interface.
type IObj ¶
type IObj interface {
// contains filtered or unexported methods
}
IObj inteface for all pdf object
type ImageCache ¶
ImageCache is metadata for caching images.
type ImageHolder ¶
ImageHolder hold image data
func ImageHolderByBytes ¶
func ImageHolderByBytes(b []byte) (ImageHolder, error)
ImageHolderByBytes create ImageHolder by []byte
func ImageHolderByPath ¶
func ImageHolderByPath(path string) (ImageHolder, error)
ImageHolderByPath create ImageHolder by image path
func ImageHolderByReader ¶
func ImageHolderByReader(r io.Reader) (ImageHolder, error)
ImageHolderByReader create ImageHolder by io.Reader
type ImageObj ¶
type ImageObj struct {
// contains filtered or unexported fields
}
ImageObj image object
func (*ImageObj) SetImagePath ¶
SetImagePath set image path
type MapOfCharacterToGlyphIndex ¶
type MapOfCharacterToGlyphIndex struct { Keys []rune Vals []uint // contains filtered or unexported fields }
MapOfCharacterToGlyphIndex map of CharacterToGlyphIndex
func NewMapOfCharacterToGlyphIndex ¶
func NewMapOfCharacterToGlyphIndex() *MapOfCharacterToGlyphIndex
NewMapOfCharacterToGlyphIndex new CharacterToGlyphIndex
func (*MapOfCharacterToGlyphIndex) AllKeys ¶
func (m *MapOfCharacterToGlyphIndex) AllKeys() []rune
AllKeys get keys
func (*MapOfCharacterToGlyphIndex) AllVals ¶
func (m *MapOfCharacterToGlyphIndex) AllVals() []uint
AllVals get all values
func (*MapOfCharacterToGlyphIndex) Index ¶
func (m *MapOfCharacterToGlyphIndex) Index(k rune) (int, bool)
Index get index by key
func (*MapOfCharacterToGlyphIndex) KeyExists ¶
func (m *MapOfCharacterToGlyphIndex) KeyExists(k rune) bool
KeyExists key is exists?
func (*MapOfCharacterToGlyphIndex) Set ¶
func (m *MapOfCharacterToGlyphIndex) Set(k rune, v uint)
Set set key and value to map
type OutlineObj ¶
type OutlineObj struct {
// contains filtered or unexported fields
}
type OutlinesObj ¶
type OutlinesObj struct {
// contains filtered or unexported fields
}
OutlinesObj : outlines dictionary
func (*OutlinesObj) AddOutline ¶
func (o *OutlinesObj) AddOutline(dest int, title string)
func (*OutlinesObj) Count ¶
func (o *OutlinesObj) Count() int
func (*OutlinesObj) SetIndexObjOutlines ¶
func (o *OutlinesObj) SetIndexObjOutlines(index int)
type PDFProtection ¶
type PDFProtection struct {
// contains filtered or unexported fields
}
PDFProtection protection in pdf
func (*PDFProtection) EncryptionObj ¶
func (p *PDFProtection) EncryptionObj() *EncryptionObj
EncryptionObj get Encryption Object
func (*PDFProtection) Objectkey ¶
func (p *PDFProtection) Objectkey(objID int) []byte
Objectkey create object key from ObjID
func (*PDFProtection) SetProtection ¶
func (p *PDFProtection) SetProtection(permissions int, userPass []byte, ownerPass []byte) error
SetProtection set protection infomation
type PDFProtectionConfig ¶
type PDFProtectionConfig struct { UseProtection bool Permissions int UserPass []byte OwnerPass []byte }
PDFProtectionConfig config of pdf protection
type PageObj ¶
type PageObj struct { Contents string ResourcesRelate string Links []linkOption // contains filtered or unexported fields }
PageObj pdf page object
type PdfDictionaryObj ¶
type PdfDictionaryObj struct { PtrToSubsetFontObj *SubsetFontObj // contains filtered or unexported fields }
PdfDictionaryObj pdf dictionary object
func (*PdfDictionaryObj) AddCompositeGlyphs ¶
func (p *PdfDictionaryObj) AddCompositeGlyphs(glyphArray *[]int, glyph int)
AddCompositeGlyphs add composite glyph composite glyph is a Unicode entity that can be defined as a sequence of one or more other characters.
func (*PdfDictionaryObj) GetOffset ¶
func (p *PdfDictionaryObj) GetOffset(glyph int) int
GetOffset get offset from glyf table
func (*PdfDictionaryObj) SetPtrToSubsetFontObj ¶
func (p *PdfDictionaryObj) SetPtrToSubsetFontObj(ptr *SubsetFontObj)
SetPtrToSubsetFontObj set subsetFontObj pointer
type PdfInfo ¶
type PdfInfo struct { Title string //The document’s title Author string //The name of the person who created the document. Subject string //The subject of the document. Creator string // If the document was converted to PDF from another format, the name of the application original document from which it was converted. Producer string //If the document was converted to PDF from another format, the name of the application (for example, Acrobat Distiller) that converted it to PDF. CreationDate time.Time //The date and time the document was created, in human-readable form }
PdfInfo Document Information Dictionary
type ProcSetObj ¶
type ProcSetObj struct { //Font Relates RelateFonts RelateXobjs RelateXobjects ExtGStates []ExtGS ImportedTemplateIds map[string]int // contains filtered or unexported fields }
ProcSetObj is a PDF procSet object.
type Rect ¶
Rect defines a rectangle.
func (*Rect) PointsToUnits ¶
PointsToUnits converts the rectangles width and height to Units. When this is called it is assumed the values of the rectangle are in Points
func (*Rect) UnitsToPoints ¶
UnitsToPoints converts the rectanlges width and height to Points. When this is called it is assumed the values of the rectangle are in Units
type RelateFont ¶
type RelateFont struct { Family string //etc /F1 CountOfFont int //etc 5 0 R IndexOfObj int Style int // Regular|Bold|Italic }
RelateFont is a metadata index for fonts?
type RelateFonts ¶
type RelateFonts []RelateFont
RelateFonts is a slice of RelateFont.
func (*RelateFonts) IsContainsFamily ¶
func (re *RelateFonts) IsContainsFamily(family string) bool
IsContainsFamily checks if font family exists.
func (*RelateFonts) IsContainsFamilyAndStyle ¶
func (re *RelateFonts) IsContainsFamilyAndStyle(family string, style int) bool
IsContainsFamilyAndStyle checks if font with same name and style already exists .
type RelateXobjects ¶
type RelateXobjects []RelateXobject
RelateXobjects is a slice of RelateXobject.
type SubfontDescriptorObj ¶
type SubfontDescriptorObj struct { PtrToSubsetFontObj *SubsetFontObj // contains filtered or unexported fields }
SubfontDescriptorObj pdf subfont descriptorObj object
func (*SubfontDescriptorObj) SetIndexObjPdfDictionary ¶
func (s *SubfontDescriptorObj) SetIndexObjPdfDictionary(index int)
SetIndexObjPdfDictionary set PdfDictionary pointer
func (*SubfontDescriptorObj) SetPtrToSubsetFontObj ¶
func (s *SubfontDescriptorObj) SetPtrToSubsetFontObj(ptr *SubsetFontObj)
SetPtrToSubsetFontObj set SubsetFont pointer
type SubsetFontObj ¶
type SubsetFontObj struct { Family string CharacterToGlyphIndex *MapOfCharacterToGlyphIndex CountOfFont int // contains filtered or unexported fields }
SubsetFontObj pdf subsetFont object
func (*SubsetFontObj) AddChars ¶
func (s *SubsetFontObj) AddChars(txt string) error
AddChars add char to map CharacterToGlyphIndex
func (*SubsetFontObj) CharCodeToGlyphIndex ¶
func (s *SubsetFontObj) CharCodeToGlyphIndex(r rune) (uint, error)
CharCodeToGlyphIndex gets glyph index from char code.
func (*SubsetFontObj) CharIndex ¶
func (s *SubsetFontObj) CharIndex(r rune) (uint, error)
CharIndex index of char in glyph table
func (*SubsetFontObj) CharWidth ¶
func (s *SubsetFontObj) CharWidth(r rune) (uint, error)
CharWidth with of char
func (*SubsetFontObj) GetFamily ¶
func (s *SubsetFontObj) GetFamily() string
GetFamily get font family name
func (*SubsetFontObj) GetTTFParser ¶
func (s *SubsetFontObj) GetTTFParser() *core.TTFParser
GetTTFParser gets TTFParser.
func (*SubsetFontObj) GetTtfFontOption ¶
func (s *SubsetFontObj) GetTtfFontOption() TtfOption
GetTtfFontOption get TtfOption must set before SetTTFByPath
func (*SubsetFontObj) GlyphIndexToPdfWidth ¶
func (s *SubsetFontObj) GlyphIndexToPdfWidth(glyphIndex uint) uint
GlyphIndexToPdfWidth gets width from glyphIndex.
func (*SubsetFontObj) KernValueByLeft ¶
func (s *SubsetFontObj) KernValueByLeft(left uint) (bool, *core.KernValue)
KernValueByLeft find kern value from kern table by left
func (*SubsetFontObj) SetFamily ¶
func (s *SubsetFontObj) SetFamily(familyname string)
SetFamily set font family name
func (*SubsetFontObj) SetIndexObjCIDFont ¶
func (s *SubsetFontObj) SetIndexObjCIDFont(index int)
SetIndexObjCIDFont set IndexObjCIDFont
func (*SubsetFontObj) SetIndexObjUnicodeMap ¶
func (s *SubsetFontObj) SetIndexObjUnicodeMap(index int)
SetIndexObjUnicodeMap set IndexObjUnicodeMap
func (*SubsetFontObj) SetTTFByPath ¶
func (s *SubsetFontObj) SetTTFByPath(ttfpath string) error
SetTTFByPath set ttf
func (*SubsetFontObj) SetTTFByReader ¶
func (s *SubsetFontObj) SetTTFByReader(rd io.Reader) error
SetTTFByReader set ttf
func (*SubsetFontObj) SetTtfFontOption ¶
func (s *SubsetFontObj) SetTtfFontOption(option TtfOption)
SetTtfFontOption set TtfOption must set before SetTTFByPath
type Transparency ¶
type Transparency struct {
IndexOfExtGState int
}
Transparency defines an object alpha.
type UnicodeMap ¶
type UnicodeMap struct { PtrToSubsetFontObj *SubsetFontObj // contains filtered or unexported fields }
UnicodeMap unicode map
func (*UnicodeMap) SetPtrToSubsetFontObj ¶
func (u *UnicodeMap) SetPtrToSubsetFontObj(ptr *SubsetFontObj)
SetPtrToSubsetFontObj set pointer to SubsetFontObj
Source Files ¶
- box.go
- buff.go
- buff_write.go
- buffer_pool.go
- cache_contact_color.go
- cache_content_gray.go
- cache_content_image.go
- cache_content_imported_object.go
- cache_content_line.go
- cache_content_line_type.go
- cache_content_line_width.go
- cache_content_oval.go
- cache_content_polygon.go
- cache_content_rectangle.go
- cache_content_rotate.go
- cache_content_text.go
- cache_contnent_curve.go
- catalog_obj.go
- cell_option.go
- cid_font_obj.go
- config.go
- content_obj.go
- current.go
- device_rgb_obj.go
- embedfont_obj.go
- encoding_obj.go
- encryption_obj.go
- ext_g_state_obj.go
- font_obj.go
- font_option.go
- fontconverthelper.go
- fontdescriptor_obj.go
- func_kern_override.go
- gopdf.go
- i_cache_contneter.go
- ifont.go
- image_holder.go
- image_obj.go
- image_obj_parse.go
- img_info.go
- imported_obj.go
- iobj.go
- link_option.go
- list_cache_content.go
- map_of_character_To_glyph_index.go
- margin.go
- outlines_obj.go
- page_obj.go
- page_option.go
- page_sizes.go
- pages_obj.go
- pdf_dictionary_obj.go
- pdf_info_obj.go
- pdf_protection.go
- point.go
- procset_obj.go
- rect.go
- smask_obj.go
- strhelper.go
- style.go
- subfont_descriptor_obj.go
- subset_font_obj.go
- ttf_option.go
- unicode_map.go