Documentation ¶
Index ¶
- type CapturedPage
- type CompositeFont
- func (q *CompositeFont) Encode(text string) string
- func (q *CompositeFont) GetAscent(fontSize float64) float64
- func (q *CompositeFont) GetUnderlinePosition(size float64) float64
- func (q *CompositeFont) GetUnderlineThickness(size float64) float64
- func (q *CompositeFont) GetWidth(text string, fontSize float64) float64
- func (q *CompositeFont) Reference() types.Reference
- type File
- func (q *File) NewCapturedPage(sourcePage types.Page, sourceFile *pdffile.File) (*CapturedPage, error)
- func (q *File) NewCompositeFont(ttf []byte) (*CompositeFont, error)
- func (q *File) NewImage(bts []byte) (*Image, error)
- func (q *File) NewPage(width, height float64) *Page
- func (q *File) NewStandardFont(name types.StandardFontName, encoding types.Encoding) (*StandardFont, error)
- func (q *File) NewTrueTypeFont(ttf []byte, encoding types.Encoding, embed bool) (*TrueTypeFont, error)
- func (q *File) Write() ([]byte, error)
- func (q *File) WriteTo(w io.Writer) (int64, error)
- type FontHandler
- type Image
- type Page
- func (q *Page) AddCapturedPage(cp *CapturedPage)
- func (q *Page) AddCommand(operator string, args ...types.Object)
- func (q *Page) AddFont(f FontHandler) types.Name
- func (q *Page) AddProcSets(pss ...types.ProcedureSet)
- func (q *Page) AddXObject(obj types.Reference) types.Name
- func (q *Page) Color_CS(name types.ColorSpaceFamily)
- func (q *Page) Color_G(gray float64)
- func (q *Page) Color_K(c, m, y, k float64)
- func (q *Page) Color_RG(r, g, b float64)
- func (q *Page) Color_SC(c ...float64)
- func (q *Page) Color_SCN(name types.Name, c ...float64)
- func (q *Page) Color_cs(name types.ColorSpaceFamily)
- func (q *Page) Color_g(gray float64)
- func (q *Page) Color_k(c, m, y, k float64)
- func (q *Page) Color_rg(r, g, b float64)
- func (q *Page) Color_sc(c ...float64)
- func (q *Page) Color_scn(name types.Name, c ...float64)
- func (q *Page) Compatibility_BX()
- func (q *Page) Compatibility_EX()
- func (q *Page) GraphicsState_J(lineCap int)
- func (q *Page) GraphicsState_M(miterLimit float64)
- func (q *Page) GraphicsState_Q()
- func (q *Page) GraphicsState_cm(a, b, c, d, e, f float64)
- func (q *Page) GraphicsState_d(dashArray []float64, dashPhase float64)
- func (q *Page) GraphicsState_gs(dictName string)
- func (q *Page) GraphicsState_i(flatness float64)
- func (q *Page) GraphicsState_j(lineJoin int)
- func (q *Page) GraphicsState_q()
- func (q *Page) GraphicsState_ri(intent string)
- func (q *Page) GraphicsState_w(lineWidth float64)
- func (q *Page) InlineImage_BI()
- func (q *Page) InlineImage_EI()
- func (q *Page) InlineImage_ID()
- func (q *Page) MarkedContent_BDC(tag, properties types.Name)
- func (q *Page) MarkedContent_BMC(tag types.Name)
- func (q *Page) MarkedContent_DP(tag, properties types.Name)
- func (q *Page) MarkedContent_EMC()
- func (q *Page) MarkedContent_MP(tag types.Name)
- func (q *Page) Path_B()
- func (q *Page) Path_Bstar()
- func (q *Page) Path_F()
- func (q *Page) Path_S()
- func (q *Page) Path_b()
- func (q *Page) Path_bstar()
- func (q *Page) Path_c(x1, y1, x2, y2, x3, y3 float64)
- func (q *Page) Path_f()
- func (q *Page) Path_fstar()
- func (q *Page) Path_h()
- func (q *Page) Path_l(x, y float64)
- func (q *Page) Path_m(x, y float64)
- func (q *Page) Path_n()
- func (q *Page) Path_re(x, y, width, height float64)
- func (q *Page) Path_s()
- func (q *Page) Path_v(x2, y2, x3, y3 float64)
- func (q *Page) Path_y(x1, y1, x3, y3 float64)
- func (q *Page) Shading_sh(name types.Name)
- func (q *Page) TextObjects_BT()
- func (q *Page) TextObjects_ET()
- func (q *Page) TextPosition_TD(tx, ty float64)
- func (q *Page) TextPosition_Td(tx, ty float64)
- func (q *Page) TextPosition_Tm(a, b, c, d, e, f float64)
- func (q *Page) TextPosition_Tstar()
- func (q *Page) TextShowing_Pos(s string)
- func (q *Page) TextShowing_Quot(ac, aw float64, s string)
- func (q *Page) TextShowing_TJ(array types.Array)
- func (q *Page) TextShowing_Tj(s string)
- func (q *Page) TextState_TL(leading float64)
- func (q *Page) TextState_Tc(charSpace float64)
- func (q *Page) TextState_Tf(font FontHandler, fontSize float64)
- func (q *Page) TextState_Tr(mode types.RenderingMode)
- func (q *Page) TextState_Ts(rise float64)
- func (q *Page) TextState_Tw(wordSpace float64)
- func (q *Page) TextState_Tz(scale float64)
- func (q *Page) Type3Font_d0(wx, wy float64)
- func (q *Page) Type3Font_d1(wx, wy, llx, lly, urx, ury float64)
- func (q *Page) XObject_Do(img types.Reference)
- type StandardFont
- func (q *StandardFont) Encode(text string) string
- func (q *StandardFont) GetAscent(fontSize float64) float64
- func (q *StandardFont) GetUnderlinePosition(fontSize float64) float64
- func (q *StandardFont) GetUnderlineThickness(fontSize float64) float64
- func (q *StandardFont) GetWidth(text string, fontSize float64) float64
- func (q *StandardFont) Reference() types.Reference
- type TrueTypeFont
- func (q *TrueTypeFont) Encode(text string) string
- func (q *TrueTypeFont) GetAscent(fontSize float64) float64
- func (q *TrueTypeFont) GetUnderlinePosition(size float64) float64
- func (q *TrueTypeFont) GetUnderlineThickness(size float64) float64
- func (q *TrueTypeFont) GetWidth(text string, fontSize float64) float64
- func (q *TrueTypeFont) Reference() types.Reference
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CapturedPage ¶ added in v1.0.5
type CapturedPage struct { Source types.Page Contents []types.Reference Resources struct { ExtGState types.Dictionary ColorSpace types.Dictionary Pattern types.Dictionary Shading types.Dictionary XObject types.Dictionary Font types.Dictionary ProcSet types.Array Properties types.Dictionary } }
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) GetAscent ¶
func (q *CompositeFont) GetAscent(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) Reference ¶
func (q *CompositeFont) Reference() types.Reference
type File ¶
type File struct { ID [2]types.String Info types.InformationDictionary Pages []*Page CompressStreams bool Version float64 // contains filtered or unexported fields }
File is the main object to create a pdf file
func (*File) NewCapturedPage ¶ added in v1.0.5
func (q *File) NewCapturedPage(sourcePage types.Page, sourceFile *pdffile.File) (*CapturedPage, error)
NewCapturedPage is used to copy a page from another pdf
func (*File) NewCompositeFont ¶
func (q *File) NewCompositeFont(ttf []byte) (*CompositeFont, error)
NewCompositeFont creates a new composite front from the given true type font
func (*File) NewImage ¶
NewImage adds a new image as XObject to the file and returns the image object and its reference
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
type FontHandler ¶
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 (*Page) AddCapturedPage ¶ added in v1.0.5
func (q *Page) AddCapturedPage(cp *CapturedPage)
AddCapturedPage adds the content of a captured page to this page
func (*Page) AddCommand ¶
AddCommand adds any command/pdf operator to the content stream of the page
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
Color_g : Same as G, but for nonstroking operations. No-Op if identical to value in current graphics state.
func (*Page) Color_k ¶
Color_k : Same as K, but for nonstroking operations. No-Op if identical to value in current graphics state.
func (*Page) Color_rg ¶
Color_rg : Same as RG, but for nonstroking operations. No-Op if identical to value in current graphics state.
func (*Page) Color_sc ¶
Color_sc : Same as SC, but for nonstroking operations. No-Op if identical to value in current graphics state.
func (*Page) Color_scn ¶
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 ¶
GraphicsState_J sets the line cap style in the graphics state (see “Line Cap Style” on page 153)
func (*Page) GraphicsState_M ¶
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 ¶
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 ¶
GraphicsState_d sets the line dash pattern in the graphics state (see “Line Dash Pattern” on page 155)
func (*Page) GraphicsState_gs ¶
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 ¶
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 ¶
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 ¶
GraphicsState_ri sets the color rendering intent in the graphics state (see “Rendering Intents” on page 197).
func (*Page) GraphicsState_w ¶
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 ¶
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 ¶
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 ¶
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 ¶
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_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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
TextShowing_Tj shows a text string.
func (*Page) TextState_TL ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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) GetAscent ¶
func (q *StandardFont) GetAscent(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) 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) GetAscent ¶
func (q *TrueTypeFont) GetAscent(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) Reference ¶
func (q *TrueTypeFont) Reference() types.Reference
Source Files ¶
- file.go
- file_capturepage.go
- file_fonts.go
- file_image.go
- fonts.go
- graphicsstate.go
- page.go
- page_color.go
- page_compatibility.go
- page_graphicsstate.go
- page_image.go
- page_inlineimage.go
- page_markedcontent.go
- page_pathconstruction.go
- page_pathpainting.go
- page_shading.go
- page_text.go
- page_textposition.go
- page_textshowing.go
- page_textstate.go
- page_type3font.go