pdf

package
v1.0.102 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompositeFont

type CompositeFont struct {
	// contains filtered or unexported fields
}

CompositeFont references a composite font and provides additional function like font metrics

func (*CompositeFont) Encode

func (q *CompositeFont) Encode(text string) string

func (*CompositeFont) FallbackFont added in v1.0.101

func (q *CompositeFont) FallbackFont() FontHandler

func (*CompositeFont) GetAscent

func (q *CompositeFont) GetAscent(fontSize float64) float64

func (*CompositeFont) GetBottom added in v1.0.31

func (q *CompositeFont) GetBottom(fontSize float64) float64

func (*CompositeFont) GetHeight added in v1.0.64

func (q *CompositeFont) GetHeight(fontSize float64) float64

func (*CompositeFont) GetTop added in v1.0.31

func (q *CompositeFont) GetTop(fontSize float64) float64

func (*CompositeFont) GetUnderlinePosition

func (q *CompositeFont) GetUnderlinePosition(size float64) float64

func (*CompositeFont) GetUnderlineThickness

func (q *CompositeFont) GetUnderlineThickness(size float64) float64

func (*CompositeFont) GetWidth

func (q *CompositeFont) GetWidth(text string, fontSize float64) float64

func (*CompositeFont) HasGylph added in v1.0.101

func (q *CompositeFont) HasGylph(runes []rune) []bool

func (*CompositeFont) Reference

func (q *CompositeFont) Reference() types.Reference

type CompositeFontOTF added in v1.0.31

type CompositeFontOTF struct {
	// contains filtered or unexported fields
}

CompositeFontOTF references a composite font and provides additional function like font metrics

func (*CompositeFontOTF) Encode added in v1.0.31

func (q *CompositeFontOTF) Encode(text string) string

func (*CompositeFontOTF) FallbackFont added in v1.0.101

func (q *CompositeFontOTF) FallbackFont() FontHandler

func (*CompositeFontOTF) GetAscent added in v1.0.31

func (q *CompositeFontOTF) GetAscent(fontSize float64) float64

func (*CompositeFontOTF) GetBottom added in v1.0.31

func (q *CompositeFontOTF) GetBottom(fontSize float64) float64

func (*CompositeFontOTF) GetHeight added in v1.0.64

func (q *CompositeFontOTF) GetHeight(fontSize float64) float64

func (*CompositeFontOTF) GetTop added in v1.0.31

func (q *CompositeFontOTF) GetTop(fontSize float64) float64

func (*CompositeFontOTF) GetUnderlinePosition added in v1.0.31

func (q *CompositeFontOTF) GetUnderlinePosition(size float64) float64

func (*CompositeFontOTF) GetUnderlineThickness added in v1.0.31

func (q *CompositeFontOTF) GetUnderlineThickness(size float64) float64

func (*CompositeFontOTF) GetWidth added in v1.0.31

func (q *CompositeFontOTF) GetWidth(text string, fontSize float64) float64

func (*CompositeFontOTF) HasGylph added in v1.0.101

func (q *CompositeFontOTF) HasGylph(runes []rune) []bool

func (*CompositeFontOTF) Reference added in v1.0.31

func (q *CompositeFontOTF) Reference() types.Reference

type File

type File struct {
	ID    [2]types.String
	Info  types.InformationDictionary
	Pages []*Page

	// Threshold length for compressing content streams
	CompressStreamsThreshold int

	// PDF Version number
	Version float64
	// contains filtered or unexported fields
}

File is the main object to create a pdf file

func NewFile

func NewFile() *File

NewFile creates a new File object

func (*File) AddMetaData added in v1.0.95

func (q *File) AddMetaData(data []byte) error

AddMetaData adds meta data to the document catalog

func (*File) CopyPage added in v1.0.85

func (q *File) CopyPage(sourcePage types.Page, sourceFile *pdffile.File) *Page

CopyPage adds and returns a new Page

func (*File) NewCapturedPage added in v1.0.5

func (q *File) NewCapturedPage(sourcePage types.Page, sourceFile *pdffile.File) (types.Reference, error)

NewCapturedPage is used to copy a page from another pdf

func (*File) NewCompositeFontFromOTF added in v1.0.31

func (q *File) NewCompositeFontFromOTF(otf []byte) (*CompositeFontOTF, error)

NewCompositeFontFromOTF creates a new composite front from the given open type font

func (*File) NewCompositeFontFromTTF added in v1.0.31

func (q *File) NewCompositeFontFromTTF(ttf []byte, fallback FontHandler) (*CompositeFont, error)

NewCompositeFontFromTTF creates a new composite front from the given true type font

func (*File) NewFormFromPage added in v1.0.26

func (q *File) NewFormFromPage(page *Page) (types.Reference, error)

NewFormFromPage creates a new form object from the given page

func (*File) NewImage

func (q *File) NewImage(bts []byte) (*Image, error)

NewImage adds a new image as XObject to the file and returns the image object and its reference

func (*File) NewPage

func (q *File) NewPage(width, height float64) *Page

NewPage adds and returns a new Page

func (*File) NewStandardFont

func (q *File) NewStandardFont(name types.StandardFontName, encoding types.Encoding) (*StandardFont, error)

NewStandardFont adds and returns a new standard font (expected to be available on all pdf consuming systems)

func (*File) NewTrueTypeFont

func (q *File) NewTrueTypeFont(ttf []byte, encoding types.Encoding, embed bool) (*TrueTypeFont, error)

NewTrueTypeFont adds and returns a new true type font

func (*File) Write

func (q *File) Write() ([]byte, error)

Write returns the PDF as byte slice

func (*File) WriteTo

func (q *File) WriteTo(w io.Writer) (int64, error)

WriteTo writes the parsed to the given writer

type FontHandler

type FontHandler interface {
	Reference() types.Reference
	Encode(s string) string
	GetWidth(text string, fontSize float64) float64
	GetAscent(fontSize float64) float64
	GetUnderlineThickness(size float64) float64
	GetUnderlinePosition(size float64) float64
	GetTop(fontSize float64) float64
	GetBottom(fontSize float64) float64
	GetHeight(fontSize float64) float64
	HasGylph(runes []rune) []bool
	FallbackFont() FontHandler
	// contains filtered or unexported methods
}

type Image

type Image struct {
	Reference types.Reference
	Image     *types.Image
}

Image holds both the Image object and the reference to it

type Page

type Page struct {
	// additional page data, can also be modified from the outside
	Data types.Page
	// contains filtered or unexported fields
}

Page holds all information about a pdf page and the commands that will be put in the content stream

func NewPage added in v1.0.26

func NewPage(width, height float64) *Page

NewPage creates and returns a new page

func (*Page) AddCommand

func (q *Page) AddCommand(operator string, args ...types.Object)

AddCommand adds any command/pdf operator to the content stream of the page

func (*Page) AddExtGState added in v1.0.49

func (q *Page) AddExtGState(obj types.Dictionary) types.Name

AddExtGState adds an ExtGState to the list of resources of the page (unless already listed) and return the resource name

func (*Page) AddFont

func (q *Page) AddFont(f FontHandler) types.Name

AddFont adds a font to the list of resources of the page (unless already list ed) and return the font name

func (*Page) AddProcSets

func (q *Page) AddProcSets(pss ...types.ProcedureSet)

AddProcSets adds ProcedureSets to the page resources unless already listed

func (*Page) AddXObject

func (q *Page) AddXObject(obj types.Reference) types.Name

AddXObject adds an XObject to the list of resources of the page (unless already listed) and return the resource name

func (*Page) Color_CS

func (q *Page) Color_CS(name types.ColorSpaceFamily)

Color_CS sets the current color space to use for stroking operations. The oper- and name must be a name object. If the color space is one that can be specified by a name and no additional parameters (DeviceGray, DeviceRGB, DeviceCMYK, and certain cases of Pattern), the name may be specified directly. Otherwise, it must be a name defined in the ColorSpace subdictionary of the current resource dictionary (see Section 3.7.2, “Resource Dictionaries”); the associated value is an array describing the color space (see Section 4.5.2, “Color Space Families”). No-Op if identical to value in current graphics state.

func (*Page) Color_G

func (q *Page) Color_G(gray float64)

Color_G sets the stroking color space to DeviceGray (or the DefaultGray color space; see “Default Color Spaces” on page 194) and set the gray level to use for stroking operations. gray is a number between 0.0 (black) and 1.0 (white). No-Op if identical to value in current graphics state.

func (*Page) Color_K

func (q *Page) Color_K(c, m, y, k float64)

Color_K sets the stroking color space to DeviceCMYK (or the DefaultCMYK color space; see “Default Color Spaces” on page 194) and set the color to use for stroking opera- tions. Each operand must be a number between 0.0 (zero concentration) and 1.0 (maximum concentration). The behavior of this operator is affected by the over- print mode (see Section 4.5.6, “Overprint Control”). No-Op if identical to value in current graphics state.

func (*Page) Color_RG

func (q *Page) Color_RG(r, g, b float64)

Color_RG sets the stroking color space to DeviceRGB (or the DefaultRGB color space; see “Default Color Spaces” on page 194) and set the color to use for stroking opera- tions. Each operand must be a number between 0.0 (minimum intensity) and 1.0 (maximum intensity). No-Op if identical to value in current graphics state.

func (*Page) Color_SC

func (q *Page) Color_SC(c ...float64)

Color_SC sets the color to use for stroking operations in a device, CIE-based (other than ICCBased), or Indexed color space. The number of operands re- quired and their interpretation depends on the current stroking color space: • For DeviceGray, CalGray, and Indexed color spaces, one operand is required (n = 1). • For DeviceRGB, CalRGB, and Lab color spaces, three operands are required (n = 3). • For DeviceCMYK, four operands are required (n = 4). No-Op if identical to value in current graphics state.

func (*Page) Color_SCN

func (q *Page) Color_SCN(name types.Name, c ...float64)

Color_SCN Same as SC, but also supports Pattern, Separation, DeviceN, and ICCBased color spaces. If the current stroking color space is a Separation, DeviceN, or ICCBased color space, the operands c1 ...cn are numbers. The number of operands and their interpretation depends on the color space. If the current stroking color space is a Pattern color space, name is the name of an entry in the Pattern subdictionary of the current resource dictionary (see Section 3.7.2, “Resource Dictionaries”). For an uncolored tiling pattern (PatternType = 1 and PaintType = 2), c1 ...cn are component values specifying a color in the pattern’s underlying color space. For other types of pattern, these operands must not be specified. No-Op if identical to value in current graphics state.

func (*Page) Color_cs

func (q *Page) Color_cs(name types.ColorSpaceFamily)

Color_cs Same as CS, but for nonstroking operations. No-Op if identical to value in current graphics state.

func (*Page) Color_g

func (q *Page) Color_g(gray float64)

Color_g : Same as G, but for nonstroking operations. No-Op if identical to value in current graphics state.

func (*Page) Color_k

func (q *Page) Color_k(c, m, y, k float64)

Color_k : Same as K, but for nonstroking operations. No-Op if identical to value in current graphics state.

func (*Page) Color_rg

func (q *Page) Color_rg(r, g, b float64)

Color_rg : Same as RG, but for nonstroking operations. No-Op if identical to value in current graphics state.

func (*Page) Color_sc

func (q *Page) Color_sc(c ...float64)

Color_sc : Same as SC, but for nonstroking operations. No-Op if identical to value in current graphics state.

func (*Page) Color_scn

func (q *Page) Color_scn(name types.Name, c ...float64)

Color_scn : Same as SCN, but for nonstroking operations. No-Op if identical to value in current graphics state.

func (*Page) Compatibility_BX

func (q *Page) Compatibility_BX()

Compatibility_BX begins a compatibility section. Unrecognized operators (along with their operands) will be ignored without error until the balancing EX operator is encoun- tered.

func (*Page) Compatibility_EX

func (q *Page) Compatibility_EX()

Compatibility_EX ends a compatibility section begun by a balancing BX operator.

func (*Page) GraphicsState_J

func (q *Page) GraphicsState_J(lineCap int)

GraphicsState_J sets the line cap style in the graphics state (see “Line Cap Style” on page 153)

func (*Page) GraphicsState_M

func (q *Page) GraphicsState_M(miterLimit float64)

GraphicsState_M sets the miter limit in the graphics state (see “Miter Limit” on page 153).

func (*Page) GraphicsState_Q

func (q *Page) GraphicsState_Q()

GraphicsState_Q restores the graphics state by removing the most recently saved state from the stack and making it the current state (see “Graphics State Stack” on page 152).

func (*Page) GraphicsState_cm

func (q *Page) GraphicsState_cm(a, b, c, d, e, f float64)

GraphicsState_cm modifies the current transformation matrix (CTM) by concatenating the specified matrix (see Section 4.2.1, “Coordinate Spaces”). Although the operands specify a matrix, they are written as six separate numbers, not as an array.

func (*Page) GraphicsState_d

func (q *Page) GraphicsState_d(dashArray []float64, dashPhase float64)

GraphicsState_d sets the line dash pattern in the graphics state (see “Line Dash Pattern” on page 155)

func (*Page) GraphicsState_gs

func (q *Page) GraphicsState_gs(dictName types.Name)

GraphicsState_gs sets the specified parameters in the graphics state. dictName is the name of a graphics state parameter dictionary in the ExtGState sub- dictionary of the current resource dictionary (see the next section).

func (*Page) GraphicsState_i

func (q *Page) GraphicsState_i(flatness float64)

GraphicsState_i sets the flatness tolerance in the graphics state (see Section 6.5.1, “Flatness Tolerance”). flatness is a number in the range 0 to 100; a value of 0 speci- fies the output device’s default flatness tolerance.

func (*Page) GraphicsState_j

func (q *Page) GraphicsState_j(lineJoin int)

GraphicsState_j sets the line join style in the graphics state (see “Line Join Style” on page 153).

func (*Page) GraphicsState_q

func (q *Page) GraphicsState_q()

GraphicsState_q saves the current graphics state on the graphics state stack (see “Graphics State Stack” on page 152).

func (*Page) GraphicsState_ri

func (q *Page) GraphicsState_ri(intent string)

GraphicsState_ri sets the color rendering intent in the graphics state (see “Rendering Intents” on page 197).

func (*Page) GraphicsState_w

func (q *Page) GraphicsState_w(lineWidth float64)

GraphicsState_w sets the line width in the graphics state (see “Line Width” on page 152).

func (*Page) InlineImage_BI

func (q *Page) InlineImage_BI()

InlineImage_BI begins an inline image object

func (*Page) InlineImage_EI

func (q *Page) InlineImage_EI()

InlineImage_EI ends an inline image object

func (*Page) InlineImage_ID

func (q *Page) InlineImage_ID()

InlineImage_ID begins the image data for an inline image object.

func (*Page) MarkedContent_BDC

func (q *Page) MarkedContent_BDC(tag, properties types.Name)

MarkedContent_BDC begins a marked-content sequence with an associated property list, terminated by a balancing EMC operator. tag is a name object indicating the role or signif- icance of the sequence; properties is either an inline dictionary containing the property list or a name object associated with it in the Properties subdiction- ary of the current resource dictionary (see Section 9.5.1, “Property Lists”).

func (*Page) MarkedContent_BMC

func (q *Page) MarkedContent_BMC(tag types.Name)

MarkedContent_BMC begins a marked-content sequence terminated by a balancing EMC operator. tag is a name object indicating the role or significance of the sequence.

func (*Page) MarkedContent_DP

func (q *Page) MarkedContent_DP(tag, properties types.Name)

MarkedContent_DP designates a marked-content point with an associated property list. tag is a name object indicating the role or significance of the point; properties is either an inline dictionary containing the property list or a name object associated with it in the Properties subdictionary of the current resource dictionary (see Section 9.5.1, “Property Lists”).

func (*Page) MarkedContent_EMC

func (q *Page) MarkedContent_EMC()

MarkedContent_EMC ends a marked-content sequence begun by a BMC or BDC operator.

func (*Page) MarkedContent_MP

func (q *Page) MarkedContent_MP(tag types.Name)

MarkedContent_MP designates a marked-content point. tag is a name object indicating the role or significance of the point.

func (*Page) Path_B

func (q *Page) Path_B()

Path_B fill and then strokes the path, using the nonzero winding number rule to determine the region to fill. This produces the same result as constructing two identical path objects, painting the first with f and the second with S. Note, however, that the fill- ing and stroking portions of the operation consult different values of several graph- ics state parameters, such as the current color. See also “Special Path-Painting Considerations” on page 462.

func (*Page) Path_Bstar

func (q *Page) Path_Bstar()

Path_Bstar fills and then strokes the path, using the even-odd rule to determine the region to fill. This operator produces the same result as B, except that the path is filled as if with f* instead of f. See also “Special Path-Painting Considerations” on page 462.

func (*Page) Path_F

func (q *Page) Path_F()

Path_F : Equivalent to f; included only for compatibility. Although applications that read PDF files must be able to accept this operator, those that generate PDF files should use f instead

func (*Page) Path_S

func (q *Page) Path_S()

Path_S strokes the path.

func (*Page) Path_b

func (q *Page) Path_b()

Path_b closes, fills, and then strokes the path, using the nonzero winding number rule to de- termine the region to fill. This operator has the same effect as the sequence h B. See also “Special Path-Painting Considerations” on page 462.

func (*Page) Path_bstar

func (q *Page) Path_bstar()

Path_bstar closes, fills, and then strokes the path, using the even-odd rule to determine the re- gion to fill. This operator has the same effect as the sequence h B*. See also “Special Path-Painting Considerations” on page 462.

func (*Page) Path_c

func (q *Page) Path_c(x1, y1, x2, y2, x3, y3 float64)

Path_c appends a cubic Bézier curve to the current path. The curve extends from the current point to the point (x3, y3), using (x1, y1) and (x2, y2) as the Bézier control points (see “Cubic Bézier Curves,” be- low). The new current point is (x3, y3).

func (*Page) Path_f

func (q *Page) Path_f()

Path_f fills the path, using the nonzero winding number rule to determine the region to fill (see “Nonzero Winding Number Rule” on page 169).

func (*Page) Path_fstar

func (q *Page) Path_fstar()

Path_fstar fills the path, using the even-odd rule to determine the region to fill (see “Even-Odd Rule” on page 170).

func (*Page) Path_h

func (q *Page) Path_h()

Path_h closes the current subpath by appending a straight line segment from the current point to the starting point of the subpath. This operator terminates the current subpath; appending another seg- ment to the current path will begin a new subpath, even if the new segment begins at the endpoint reached by the h operation. If the current subpath is already closed, h does nothing.

func (*Page) Path_l

func (q *Page) Path_l(x, y float64)

Path_l appends a straight line segment from the current point to the point (x, y). The new current point is (x, y).

func (*Page) Path_m

func (q *Page) Path_m(x, y float64)

Path_m begins a new subpath by moving the current point to coordinates (x, y), omitting any connecting line segment. If the previous path construction operator in the current path was also m, the new m overrides it; no vestige of the previous m operation remains in the path.

func (*Page) Path_n

func (q *Page) Path_n()

Path_n ends the path object without filling or stroking it. This operator is a “path-painting no-op,” used primarily for the side effect of changing the current clipping path (see Section 4.4.3, “Clipping Path Operators”).

func (*Page) Path_re

func (q *Page) Path_re(x, y, width, height float64)

Path_re append a rectangle to the current path as a complete subpath, with lower-left corner (x, y) and dimensions width and height in user space.

func (*Page) Path_s

func (q *Page) Path_s()

Path_s closes and stroke the path. This operator has the same effect as the sequence h S.

func (*Page) Path_v

func (q *Page) Path_v(x2, y2, x3, y3 float64)

Path_v appends a cubic Bézier curve to the current path. The curve extends from the current point to the point (x3, y3), using the current point and (x2, y2) as the Bézier control points (see “Cubic Bézier Curves,” below). The new current point is (x3, y3).

func (*Page) Path_y

func (q *Page) Path_y(x1, y1, x3, y3 float64)

Path_y appends a cubic Bézier curve to the current path. The curve extends from the current point to the point (x3, y3), using (x1, y1) and (x3, y3) as the Bézier control points (see “Cubic Bézier Curves,” be- low). The new current point is (x3, y3).

func (*Page) Shading_sh

func (q *Page) Shading_sh(name types.Name)

Shading_sh paints the shape and color shading described by a shading dictionary, sub- ject to the current clipping path. The current color in the graphics state is neither used nor altered. The effect is different from that of painting a path using a shading pattern as the current color. name is the name of a shading dictionary resource in the Shading subdictionary of the current resource dictionary (see Section 3.7.2, “Resource Dictionaries”). All co- ordinates in the shading dictionary are interpreted relative to the current user space. (By contrast, when a shading dictionary is used in a type 2 pattern, the coordinates are expressed in pattern space.) All colors are interpreted in the color space identified by the shading dictionary’s ColorSpace entry (see Table 4.25 on page 234). The Background entry, if present, is ignored. This operator should be applied only to bounded or geometrically defined shad- ings. If applied to an unbounded shading, it will paint the shading’s gradient fill across the entire clipping region, which may be time-consuming.

func (*Page) TextObjects_BT

func (q *Page) TextObjects_BT()

TextObjects_BT begins a text object, initializing the text matrix, Tm , and the text line matrix, Tlm , to the identity matrix. Text objects cannot be nested; a second BT cannot appear before an ET.

func (*Page) TextObjects_ET

func (q *Page) TextObjects_ET()

TextObjects_ET ends a text object, discarding the text matrix.

func (*Page) TextPosition_TD

func (q *Page) TextPosition_TD(tx, ty float64)

TextPosition_TD moves to the start of the next line, offset from the start of the current line by (t x , t y ). As a side effect, this operator sets the leading parameter in the text state. This operator has the same effect as the code −t y TL tx ty Td

func (*Page) TextPosition_Td

func (q *Page) TextPosition_Td(tx, ty float64)

TextPosition_Td Move to the start of the next line, offset from the start of the current line by (tx , ty ). tx and ty are numbers expressed in unscaled text space units.

func (*Page) TextPosition_Tm

func (q *Page) TextPosition_Tm(a, b, c, d, e, f float64)

TextPosition_Tm set the text matrix, Tm , and the text line matrix, Tlm

func (*Page) TextPosition_Tstar

func (q *Page) TextPosition_Tstar()

TextPosition_Tstar moves to the start of the next line. This operator has the same effect as the code 0 Tl Td where Tl is the current leading parameter in the text state.

func (*Page) TextShowing_Pos

func (q *Page) TextShowing_Pos(s string)

TextShowing_Pos moves to the next line and show a text string. This operator has the same effect as the code T* string T

func (*Page) TextShowing_Quot

func (q *Page) TextShowing_Quot(ac, aw float64, s string)

TextShowing_Quot moves to the next line and show a text string, using a w as the word spacing and a c as the character spacing (setting the corresponding parameters in the text state). a w and a c are numbers expressed in unscaled text space units. This operator has the same effect as the code aw Tw ac Tc string '

func (*Page) TextShowing_TJ

func (q *Page) TextShowing_TJ(array types.Array)

TextShowing_TJ shows one or more text strings, allowing individual glyph positioning (see imple- mentation note 40 in Appendix H). Each element of array can be a string or a number. If the element is a string, this operator shows the string. If it is a num- ber, the operator adjusts the text position by that amount; that is, it translates the text matrix, Tm . The number is expressed in thousandths of a unit of text space (see Section 5.3.3, “Text Space Details,” and implementation note 41 in Appendix H). This amount is subtracted from the current horizontal or vertical coordinate, depending on the writing mode. In the default coordinate system, a positive adjustment has the effect of moving the next glyph painted either to the left or down by the given amount. Figure 5.11 shows an example of the effect of passing offsets to TJ.

func (*Page) TextShowing_Tj

func (q *Page) TextShowing_Tj(s string)

TextShowing_Tj shows a text string.

func (*Page) TextState_TL

func (q *Page) TextState_TL(leading float64)

TextState_TL sets the text leading, Tl , to leading, which is a number expressed in unscaled text space units. Text leading is used only by the T*, ', and " operators. Initial value: 0. No-Op if identical to value in current text state

func (*Page) TextState_Tc

func (q *Page) TextState_Tc(charSpace float64)

TextState_Tc sets the character spacing, Tc , to charSpace, which is a number expressed in un- scaled text space units. Character spacing is used by the Tj, TJ, and ' operators. Initial value: 0. No-Op if identical to value in current text state

func (*Page) TextState_Tf

func (q *Page) TextState_Tf(font FontHandler, fontSize float64)

TextState_Tf set the text font, Tf , to font and the text font size, Tfs , to size. font is the name of a font resource in the Font subdictionary of the current resource dictionary; size is a number representing a scale factor. There is no initial value for either font or size; they must be specified explicitly using Tf before any text is shown. No-Op if identical to value in current text state

func (*Page) TextState_Tr

func (q *Page) TextState_Tr(mode types.RenderingMode)

TextState_Tr sets the text rendering mode, Tmode , to render, which is an integer. Initial value: 0. No-Op if identical to value in current text state

func (*Page) TextState_Ts

func (q *Page) TextState_Ts(rise float64)

TextState_Ts sets the text rise, Trise , to rise, which is a number expressed in unscaled text space units. Initial value: 0 No-Op if identical to value in current text state

func (*Page) TextState_Tw

func (q *Page) TextState_Tw(wordSpace float64)

TextState_Tw set the word spacing, Tw , to wordSpace, which is a number expressed in unscaled text space units. Word spacing is used by the Tj, TJ, and ' operators. Initial value: 0. No-Op if identical to value in current text state

func (*Page) TextState_Tz

func (q *Page) TextState_Tz(scale float64)

TextState_Tz sets the horizontal scaling, Th , to (scale ̃ 100). scale is a number specifying the percentage of the normal width. Initial value: 100 (normal width). No-Op if identical to value in current text state

func (*Page) Type3Font_d0

func (q *Page) Type3Font_d0(wx, wy float64)

Type3Font_d0 sets width information for the glyph and declare that the glyph descrip- tion specifies both its shape and its color. (Note that this operator name ends in the digit 0.) wx specifies the horizontal displacement in the glyph coordinate system; it must be consistent with the corresponding width in the font’s Widths array. w y must be 0 (see Section 5.1.3, “Glyph Posi- tioning and Metrics”). This operator is permitted only in a content stream appearing in a Type 3 font’s CharProcs dictionary. It is typically used only if the glyph description executes operators to set the color explicitly.

func (*Page) Type3Font_d1

func (q *Page) Type3Font_d1(wx, wy, llx, lly, urx, ury float64)

Type3Font_d1 sets width and bounding box information for the glyph and declare that the glyph description specifies only shape, not color. (Note that this operator name ends in the digit 1.) wx specifies the horizontal displace- ment in the glyph coordinate system; it must be consistent with the corresponding width in the font’s Widths array. w y must be 0 (see Sec- tion 5.1.3, “Glyph Positioning and Metrics”). llx and ll y are the coordinates of the lower-left corner, and ur x and ur y the upper-right corner, of the glyph bounding box. The glyph bounding box is the smallest rectangle, oriented with the axes of the glyph coordinate system, that completely encloses all marks placed on the page as a result of executing the glyph’s description. The declared bounding box must be correct—in other words, sufficiently large to enclose the entire glyph. If any marks fall outside this bounding box, the result is unpredictable. A glyph description that begins with the d1 operator should not execute any operators that set the color (or other color-related parameters) in the graphics state; any use of such operators will be ignored. The glyph description is executed solely to determine the glyph’s shape; its color is determined by the graphics state in effect each time this glyph is painted by a text-showing operator. For the same reason, the glyph description may not include an image; however, an image mask is acceptable, since it merely defines a region of the page to be painted with the current color. This operator is permitted only in a content stream appearing in a Type 3 font’s CharProcs dictionary.

func (*Page) XObject_Do

func (q *Page) XObject_Do(img types.Reference)

XObject_Do paints the specified XObject. The operand name must appear as a key in the XObject subdictionary of the current resource dictionary (see Section 3.7.2, “Resource Dictionaries”); the associated value must be a stream whose Type entry, if present, is XObject. The effect of Do depends on the value of the XObject’s Subtype entry, which may be Image (see Section 4.8.4, “Image Dic- tionaries”), Form (Section 4.9, “Form XObjects”), or PS (Section 4.10, “Post- Script XObjects”).

type StandardFont

type StandardFont struct {
	// contains filtered or unexported fields
}

StandardFont references a standard font and provides additional function like font metrics

func (*StandardFont) Encode

func (q *StandardFont) Encode(text string) string

func (*StandardFont) FallbackFont added in v1.0.101

func (q *StandardFont) FallbackFont() FontHandler

func (*StandardFont) GetAscent

func (q *StandardFont) GetAscent(fontSize float64) float64

func (*StandardFont) GetBottom added in v1.0.31

func (q *StandardFont) GetBottom(fontSize float64) float64

func (*StandardFont) GetHeight added in v1.0.64

func (q *StandardFont) GetHeight(fontSize float64) float64

func (*StandardFont) GetTop added in v1.0.31

func (q *StandardFont) GetTop(fontSize float64) float64

func (*StandardFont) GetUnderlinePosition

func (q *StandardFont) GetUnderlinePosition(fontSize float64) float64

func (*StandardFont) GetUnderlineThickness

func (q *StandardFont) GetUnderlineThickness(fontSize float64) float64

func (*StandardFont) GetWidth

func (q *StandardFont) GetWidth(text string, fontSize float64) float64

func (*StandardFont) HasGylph added in v1.0.101

func (q *StandardFont) HasGylph(runes []rune) []bool

func (*StandardFont) Reference

func (q *StandardFont) Reference() types.Reference

type TrueTypeFont

type TrueTypeFont struct {
	// contains filtered or unexported fields
}

TrueTypeFont references a TrueType font and provides additional function like font metrics

func (*TrueTypeFont) Encode

func (q *TrueTypeFont) Encode(text string) string

func (*TrueTypeFont) FallbackFont added in v1.0.101

func (q *TrueTypeFont) FallbackFont() FontHandler

func (*TrueTypeFont) GetAscent

func (q *TrueTypeFont) GetAscent(fontSize float64) float64

func (*TrueTypeFont) GetBottom added in v1.0.31

func (q *TrueTypeFont) GetBottom(fontSize float64) float64

func (*TrueTypeFont) GetHeight added in v1.0.64

func (q *TrueTypeFont) GetHeight(fontSize float64) float64

func (*TrueTypeFont) GetTop added in v1.0.31

func (q *TrueTypeFont) GetTop(fontSize float64) float64

func (*TrueTypeFont) GetUnderlinePosition

func (q *TrueTypeFont) GetUnderlinePosition(size float64) float64

func (*TrueTypeFont) GetUnderlineThickness

func (q *TrueTypeFont) GetUnderlineThickness(size float64) float64

func (*TrueTypeFont) GetWidth

func (q *TrueTypeFont) GetWidth(text string, fontSize float64) float64

func (*TrueTypeFont) HasGylph added in v1.0.101

func (q *TrueTypeFont) HasGylph(runes []rune) []bool

func (*TrueTypeFont) Reference

func (q *TrueTypeFont) Reference() types.Reference

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL