contentstream

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 18 Imported by: 2

Documentation

Overview

This package defines the commands used in PDF content stream objects. They can be chained to build an arbitrary content (see `WriteOperations` and the higher level `Appearance` object). Reciprocally, they can be obtained from a content by parsing it, using for instance the 'parser' package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteOperations

func WriteOperations(ops ...Operation) []byte

WriteOperations concatenate the given operations.

Types

type Fl

type Fl = model.Fl

func ParseImage

func ParseImage(r io.Reader, mimeType string) (*model.XObjectImage, Fl, error)

ParseImage supports importing JPEG, PNG, GIFF and TIFF images, according to the given MIME type. A dpi is returned: it's a default value (72) for JPG/JPEG images, and the one found in the image for PNG and GIFF.

func ParseImageFile

func ParseImageFile(filename string) (*model.XObjectImage, Fl, error)

ParseImageFile read the image type from the file extension. See `ParseImage` for more details.

type GradientComplex

type GradientComplex struct {
	Direction  GradientDirection // required
	Offsets    []Fl              // between 0 and 1, should contain at least 2 elements
	Colors     [][4]Fl           // RGBA values, between 0 and 1
	Reapeating bool
}

GradientComplex supports multiple stops and opacities.

func (GradientComplex) BuildShadings

func (gr GradientComplex) BuildShadings() (color, alpha *model.ShadingDict)

BuildShadings returns the shadings objects to use in a stream `alpha` may be nil if no opacity channel is needed.

type GradientDirection

type GradientDirection interface {
	// contains filtered or unexported methods
}

GradientDirection is either GradientRadial or GradientLinear

type GradientLinear

type GradientLinear [4]Fl

x1, y1, x2, y2

type GradientPointGray

type GradientPointGray struct {
	X, Y Fl
	G    uint8
}

GradientPointGray defines the position and the gray color of a gradient step.

type GradientPointRGB

type GradientPointRGB struct {
	X, Y Fl
	RGB
}

GradientPointRGB defines the position and the (RGB) color of a gradient step.

type GradientRadial

type GradientRadial [6]Fl

cx, cy, fx, fy, r, fr

type GraphicState

type GraphicState struct {
	Font     fonts.BuiltFont // the current usable font
	FontSize Fl

	XTLM    Fl // The x position of the text line matrix.
	YTLM    Fl // The y position of the text line matrix.
	Leading Fl // The current text leading.
	Matrix  model.Matrix
	// contains filtered or unexported fields
}

type GraphicStream

type GraphicStream struct {
	State GraphicState

	BoundingBox model.Rectangle
	// contains filtered or unexported fields
}

GraphicStream is a buffer of graphics operation, with a state. It provides convenient methods to ease the creation of a content stream. Once ready, it can be transformed to an XObjectForm, a Page object or a Tilling pattern.

func NewGraphicStream

func NewGraphicStream(bbox model.Rectangle) GraphicStream

NewGraphicStream setup the BBox and initialize the resources dictionary.

func (GraphicStream) AddExtGState

func (ap GraphicStream) AddExtGState(newExtGState *model.GraphicState) model.ObjName

AddExtGState checks if the graphic state is in the resources map or generate a new name and adds the graphic state to the resources.

func (*GraphicStream) AddPattern

func (ap *GraphicStream) AddPattern(newPattern model.Pattern) model.ObjName

AddPattern checks if the pattern is in the resources map or generate a new name and adds the pattern.

func (GraphicStream) AddShading

func (ap GraphicStream) AddShading(newShading *model.ShadingDict) model.ObjName

AddShading checks is the shading is in the resources map or generates a new name and adds the shading.

func (*GraphicStream) AddXObject

func (ap *GraphicStream) AddXObject(obj model.XObject)

AddXObject is the same as AddXObjectDims, but do not change the CTM.

func (*GraphicStream) AddXObjectDims

func (ap *GraphicStream) AddXObjectDims(obj model.XObject, x, y, width, height Fl)

AddXObjectDims puts an image or an XObjectForm in the current page, at the given position, with the given dimentions. See `RenderingDims` for several ways of specifying image dimentions.

func (GraphicStream) ApplyToPageObject

func (ap GraphicStream) ApplyToPageObject(page *model.PageObject, compress bool)

ApplyToPageObject update the given page with a single Content, build from the appearance. The content is optionaly compressed with the Flater filter.

func (GraphicStream) ApplyToTilling

func (ap GraphicStream) ApplyToTilling(pattern *model.PatternTiling)

ApplyToTilling update the fields BBox, ContentStream and Resources of the given pattern.

func (*GraphicStream) BeginText

func (ap *GraphicStream) BeginText()

BeginText starts the writing of text.

func (*GraphicStream) BeginVariableText

func (ap *GraphicStream) BeginVariableText()

BeginVariableText starts a MarkedContent sequence of text

func (*GraphicStream) EndText

func (ap *GraphicStream) EndText()

EndText ends the writing of text

func (*GraphicStream) EndVariableText

func (ap *GraphicStream) EndVariableText()

EndVariableText end a MarkedContent sequence of text

func (*GraphicStream) FillLinearGradientRGB

func (ap *GraphicStream) FillLinearGradientRGB(from, to GradientPointRGB)

AddLinearGradientRGB builds a linear gradient shading dictionnary, and use it to fill the current path.

The vector's origin and destination are specified by the points `from` and `to`, expressed in user space units. In a linear gradient, blending occurs perpendicularly to this vector. Color 1 is used up to the origin of the vector and color 2 is used beyond the vector's end point. Between the points the colors are gradually blended.

func (*GraphicStream) FillRadialGradientRGB

func (ap *GraphicStream) FillRadialGradientRGB(from, to GradientPointRGB, radius Fl)

AddRadialGradientRGB builds a radial gradient shading dictionnary, and use it to fill the current path.

Color 1 begins at the origin point specified by `from`. Color 2 begins at the circle specified by the center point `to` and `radius`. Colors are gradually blended from the origin to the circle. The origin and the circle's center do not necessarily have to coincide, but the origin must be within the circle to avoid rendering problems.

func (*GraphicStream) MoveText

func (ap *GraphicStream) MoveText(x, y Fl)

MoveText moves to the start of the next line, offset from the start of the current line.

func (*GraphicStream) NewlineShowText

func (ap *GraphicStream) NewlineShowText(text string) error

NewlineShowText moves to the next line and shows text.

func (*GraphicStream) Ops

func (ap *GraphicStream) Ops(op ...Operation)

Ops adds one or more graphic command. Some commands usually need to also update the state: see the other methods.

func (*GraphicStream) RestoreState

func (ap *GraphicStream) RestoreState() error

RestoreState restores the graphic state. An error is returned (only) if the calls of SaveState and RestoreState are not balanced.

func (*GraphicStream) SaveState

func (ap *GraphicStream) SaveState()

Saves the graphic state. SaveState and RestoreState must be balanced.

func (*GraphicStream) SetAlphaMask

func (ap *GraphicStream) SetAlphaMask(transparency *model.XObjectForm)

SetAlphaMask adds the given `transparency` content as an alpha mask in the graphic state.

func (*GraphicStream) SetColorFill

func (app *GraphicStream) SetColorFill(c color.Color)

func (*GraphicStream) SetColorStroke

func (app *GraphicStream) SetColorStroke(c color.Color)

func (*GraphicStream) SetFillAlpha

func (app *GraphicStream) SetFillAlpha(alpha Fl)

func (*GraphicStream) SetFontAndSize

func (ap *GraphicStream) SetFontAndSize(font fonts.BuiltFont, size Fl)

SetFontAndSize sets the font and the size (in points) for the subsequent text writing.

func (*GraphicStream) SetGraphicState

func (app *GraphicStream) SetGraphicState(state *model.GraphicState)

SetGraphicState register the given state and write it on the stream

func (*GraphicStream) SetLeading

func (ap *GraphicStream) SetLeading(leading Fl)

SetLeading sets the text leading parameter, which is measured in text space units. It specifies the vertical distance between the baselines of adjacent lines of text.

func (*GraphicStream) SetStrokeAlpha

func (app *GraphicStream) SetStrokeAlpha(alpha Fl)

func (*GraphicStream) SetTextMatrix

func (ap *GraphicStream) SetTextMatrix(a, b, c, d, x, y Fl)

SetTextMatrix changes the text matrix. This operation also initializes the current point position.

func (*GraphicStream) Shading

func (app *GraphicStream) Shading(sh *model.ShadingDict)

Shading register the given shading and apply it on the stream. It is a shortcut for `AddShading` followed by `Ops(OpShFill)`.

func (*GraphicStream) ShowText

func (ap *GraphicStream) ShowText(text string) error

ShowText shows the `text`, after encoding it according to the current font. And error is returned (only) if a font has not been setup. A typical text drawing should apply the following methods ;

  • BeginText
  • SetFontAndSize
  • ShowText
  • EndText

func (GraphicStream) ToXFormObject

func (ap GraphicStream) ToXFormObject(compress bool) *model.XObjectForm

ToXFormObject write the appearance to a new object, and associate it the resources, which are shallow copied. The content is optionaly compressed with the Flater filter.

func (*GraphicStream) Transform

func (ap *GraphicStream) Transform(mat model.Matrix)

Transform changes the current matrix, by applying a Concat Op with the given `mat` and updating the current state.

type ImageColorSpace

type ImageColorSpace interface {
	Write() string
	// contains filtered or unexported methods
}

ImageColorSpace is either:

  • a device color space
  • a limited form of Indexed colour space whose base colour space is a device space and whose colour table is specified by a byte string
  • a name

type ImageColorSpaceIndexed

type ImageColorSpaceIndexed struct {
	Base   model.ColorSpaceName // required, must be a Device CS
	Lookup model.ColorTableBytes
	Hival  uint8
}

ImageColorSpaceIndexed is written in PDF as [/Indexed base hival lookup ]

func (ImageColorSpaceIndexed) ToColorSpace

func (c ImageColorSpaceIndexed) ToColorSpace() model.ColorSpace

func (ImageColorSpaceIndexed) Write

func (c ImageColorSpaceIndexed) Write() string

type ImageColorSpaceName

type ImageColorSpaceName struct {
	model.ColorSpaceName
}

ImageColorSpaceName is a custom name or a device

func (ImageColorSpaceName) Write

func (c ImageColorSpaceName) Write() string

type OpBeginIgnoreUndef

type OpBeginIgnoreUndef struct{}

BX

func (OpBeginIgnoreUndef) Add

func (o OpBeginIgnoreUndef) Add(out *bytes.Buffer)

EX

type OpBeginImage

type OpBeginImage struct {
	ColorSpace ImageColorSpace
	Image      model.Image
}

BI ... ID ... EI

func (OpBeginImage) Add

func (o OpBeginImage) Add(out *bytes.Buffer)

func (OpBeginImage) Metrics

func (img OpBeginImage) Metrics(res model.ResourcesColorSpace) (comps, bits int, err error)

Metrics returns the number of color components and the number of bits for each. An error is returned if the color space can't be resolved from the resources dictionary.

type OpBeginMarkedContent

type OpBeginMarkedContent struct {
	Properties PropertyList
	Tag        model.ObjName
}

BMC or BDC depending on Properties

func (OpBeginMarkedContent) Add

func (o OpBeginMarkedContent) Add(out *bytes.Buffer)

type OpBeginText

type OpBeginText struct{}

BT

func (OpBeginText) Add

func (o OpBeginText) Add(out *bytes.Buffer)

type OpClip

type OpClip struct{}

W

func (OpClip) Add

func (o OpClip) Add(out *bytes.Buffer)

type OpCloseEOFillStroke

type OpCloseEOFillStroke struct{}

b*

func (OpCloseEOFillStroke) Add

func (o OpCloseEOFillStroke) Add(out *bytes.Buffer)

type OpCloseFillStroke

type OpCloseFillStroke struct{}

b

func (OpCloseFillStroke) Add

func (o OpCloseFillStroke) Add(out *bytes.Buffer)

type OpClosePath

type OpClosePath struct{}

h

func (OpClosePath) Add

func (o OpClosePath) Add(out *bytes.Buffer)

type OpCloseStroke

type OpCloseStroke struct{}

s

func (OpCloseStroke) Add

func (o OpCloseStroke) Add(out *bytes.Buffer)

type OpConcat

type OpConcat struct {
	Matrix model.Matrix
}

cm

func (OpConcat) Add

func (o OpConcat) Add(out *bytes.Buffer)

type OpCubicTo

type OpCubicTo struct {
	// P1 et P2 are the control points
	X1, Y1, X2, Y2, X3, Y3 Fl
}

c

func (OpCubicTo) Add

func (o OpCubicTo) Add(out *bytes.Buffer)

type OpCurveTo

type OpCurveTo struct {
	// P1 is the control point
	X1, Y1, X3, Y3 Fl
}

y

func (OpCurveTo) Add

func (o OpCurveTo) Add(out *bytes.Buffer)

type OpCurveTo1

type OpCurveTo1 struct {
	// P2 is the control point
	X2, Y2, X3, Y3 Fl
}

v

func (OpCurveTo1) Add

func (o OpCurveTo1) Add(out *bytes.Buffer)

type OpEOClip

type OpEOClip struct{}

W*

func (OpEOClip) Add

func (o OpEOClip) Add(out *bytes.Buffer)

type OpEOFill

type OpEOFill struct{}

f*

func (OpEOFill) Add

func (o OpEOFill) Add(out *bytes.Buffer)

type OpEOFillStroke

type OpEOFillStroke struct{}

B*

func (OpEOFillStroke) Add

func (o OpEOFillStroke) Add(out *bytes.Buffer)

type OpEndIgnoreUndef

type OpEndIgnoreUndef struct{}

func (OpEndIgnoreUndef) Add

func (o OpEndIgnoreUndef) Add(out *bytes.Buffer)

type OpEndMarkedContent

type OpEndMarkedContent struct{}

EMC

func (OpEndMarkedContent) Add

func (o OpEndMarkedContent) Add(out *bytes.Buffer)

type OpEndPath

type OpEndPath struct{}

n OpEndPath is the same as new path.

func (OpEndPath) Add

func (o OpEndPath) Add(out *bytes.Buffer)

type OpEndText

type OpEndText struct{}

ET

func (OpEndText) Add

func (o OpEndText) Add(out *bytes.Buffer)

type OpFill

type OpFill struct{}

f

func (OpFill) Add

func (o OpFill) Add(out *bytes.Buffer)

type OpFillStroke

type OpFillStroke struct{}

B

func (OpFillStroke) Add

func (o OpFillStroke) Add(out *bytes.Buffer)

type OpLineTo

type OpLineTo struct {
	X, Y Fl
}

l

func (OpLineTo) Add

func (o OpLineTo) Add(out *bytes.Buffer)

type OpMarkPoint

type OpMarkPoint struct {
	Properties PropertyList // optional
	Tag        model.ObjName
}

MP or DP depending on Properties

func (OpMarkPoint) Add

func (o OpMarkPoint) Add(out *bytes.Buffer)

type OpMoveSetShowText

type OpMoveSetShowText struct {
	Text                          string // unescaped
	WordSpacing, CharacterSpacing Fl
}

\"

func (OpMoveSetShowText) Add

func (o OpMoveSetShowText) Add(out *bytes.Buffer)

type OpMoveShowText

type OpMoveShowText struct {
	Text string // unescaped
}

'

func (OpMoveShowText) Add

func (o OpMoveShowText) Add(out *bytes.Buffer)

type OpMoveTo

type OpMoveTo struct {
	X, Y Fl
}

m

func (OpMoveTo) Add

func (o OpMoveTo) Add(out *bytes.Buffer)

type OpRectangle

type OpRectangle struct {
	X, Y, W, H Fl
}

re

func (OpRectangle) Add

func (o OpRectangle) Add(out *bytes.Buffer)

type OpRestore

type OpRestore struct{}

Q

func (OpRestore) Add

func (o OpRestore) Add(out *bytes.Buffer)

type OpSave

type OpSave struct{}

q

func (OpSave) Add

func (o OpSave) Add(out *bytes.Buffer)

type OpSetCacheDevice

type OpSetCacheDevice struct {
	WX, WY, LLX, LLY, URX, URY int // glyph units
}

d1

func (OpSetCacheDevice) Add

func (o OpSetCacheDevice) Add(out *bytes.Buffer)

type OpSetCharSpacing

type OpSetCharSpacing struct {
	CharSpace Fl
}

Tc

func (OpSetCharSpacing) Add

func (o OpSetCharSpacing) Add(out *bytes.Buffer)

type OpSetCharWidth

type OpSetCharWidth struct {
	WX, WY int // glyph units
}

d0

func (OpSetCharWidth) Add

func (o OpSetCharWidth) Add(out *bytes.Buffer)

type OpSetDash

type OpSetDash struct {
	Dash model.DashPattern
}

d

func (OpSetDash) Add

func (o OpSetDash) Add(out *bytes.Buffer)

type OpSetExtGState

type OpSetExtGState struct {
	Dict model.ObjName
}

gs

func (OpSetExtGState) Add

func (o OpSetExtGState) Add(out *bytes.Buffer)

type OpSetFillCMYKColor

type OpSetFillCMYKColor struct {
	C, M, Y, K Fl
}

k

func (OpSetFillCMYKColor) Add

func (o OpSetFillCMYKColor) Add(out *bytes.Buffer)

type OpSetFillColor

type OpSetFillColor struct {
	Color []Fl
}

sc

func (OpSetFillColor) Add

func (o OpSetFillColor) Add(out *bytes.Buffer)

type OpSetFillColorN

type OpSetFillColorN struct {
	Pattern model.ObjName // optional
	Color   []Fl
}

scn

func (OpSetFillColorN) Add

func (o OpSetFillColorN) Add(out *bytes.Buffer)

type OpSetFillColorSpace

type OpSetFillColorSpace OpSetStrokeColorSpace

cs

func (OpSetFillColorSpace) Add

func (o OpSetFillColorSpace) Add(out *bytes.Buffer)

type OpSetFillGray

type OpSetFillGray struct {
	G Fl
}

g

func (OpSetFillGray) Add

func (o OpSetFillGray) Add(out *bytes.Buffer)

type OpSetFillRGBColor

type OpSetFillRGBColor struct {
	R, G, B Fl
}

rg

func (OpSetFillRGBColor) Add

func (o OpSetFillRGBColor) Add(out *bytes.Buffer)

type OpSetFlat

type OpSetFlat struct {
	Flatness Fl // between 0 to 100
}

i

func (OpSetFlat) Add

func (o OpSetFlat) Add(out *bytes.Buffer)

type OpSetFont

type OpSetFont struct {
	Font model.ObjName
	Size Fl
}

Tf

func (OpSetFont) Add

func (o OpSetFont) Add(out *bytes.Buffer)

type OpSetHorizScaling

type OpSetHorizScaling struct {
	Scale Fl
}

Tz

func (OpSetHorizScaling) Add

func (o OpSetHorizScaling) Add(out *bytes.Buffer)

type OpSetLineCap

type OpSetLineCap struct {
	Style uint8
}

J

func (OpSetLineCap) Add

func (o OpSetLineCap) Add(out *bytes.Buffer)

type OpSetLineJoin

type OpSetLineJoin struct {
	Style uint8
}

j

func (OpSetLineJoin) Add

func (o OpSetLineJoin) Add(out *bytes.Buffer)

type OpSetLineWidth

type OpSetLineWidth struct {
	W Fl
}

w

func (OpSetLineWidth) Add

func (o OpSetLineWidth) Add(out *bytes.Buffer)

type OpSetMiterLimit

type OpSetMiterLimit struct {
	Limit Fl
}

M

func (OpSetMiterLimit) Add

func (o OpSetMiterLimit) Add(out *bytes.Buffer)

type OpSetRenderingIntent

type OpSetRenderingIntent struct {
	Intent model.ObjName
}

ri

func (OpSetRenderingIntent) Add

func (o OpSetRenderingIntent) Add(out *bytes.Buffer)

type OpSetStrokeCMYKColor

type OpSetStrokeCMYKColor OpSetFillCMYKColor

K

func (OpSetStrokeCMYKColor) Add

func (o OpSetStrokeCMYKColor) Add(out *bytes.Buffer)

type OpSetStrokeColor

type OpSetStrokeColor OpSetFillColor

SC

func (OpSetStrokeColor) Add

func (o OpSetStrokeColor) Add(out *bytes.Buffer)

type OpSetStrokeColorN

type OpSetStrokeColorN OpSetFillColorN

SCN

func (OpSetStrokeColorN) Add

func (o OpSetStrokeColorN) Add(out *bytes.Buffer)

type OpSetStrokeColorSpace

type OpSetStrokeColorSpace struct {
	ColorSpace model.ColorSpaceName // either a ColorSpaceName, or a name of a resource
}

CS

func (OpSetStrokeColorSpace) Add

func (o OpSetStrokeColorSpace) Add(out *bytes.Buffer)

type OpSetStrokeGray

type OpSetStrokeGray OpSetFillGray

G

func (OpSetStrokeGray) Add

func (o OpSetStrokeGray) Add(out *bytes.Buffer)

type OpSetStrokeRGBColor

type OpSetStrokeRGBColor OpSetFillRGBColor

RG

func (OpSetStrokeRGBColor) Add

func (o OpSetStrokeRGBColor) Add(out *bytes.Buffer)

type OpSetTextLeading

type OpSetTextLeading struct {
	L Fl
}

TL

func (OpSetTextLeading) Add

func (o OpSetTextLeading) Add(out *bytes.Buffer)

type OpSetTextMatrix

type OpSetTextMatrix struct {
	Matrix model.Matrix
}

Tm

func (OpSetTextMatrix) Add

func (o OpSetTextMatrix) Add(out *bytes.Buffer)

type OpSetTextRender

type OpSetTextRender struct {
	Render uint8
}

Tr

func (OpSetTextRender) Add

func (o OpSetTextRender) Add(out *bytes.Buffer)

type OpSetTextRise

type OpSetTextRise struct {
	Rise Fl
}

Ts

func (OpSetTextRise) Add

func (o OpSetTextRise) Add(out *bytes.Buffer)

type OpSetWordSpacing

type OpSetWordSpacing struct {
	WordSpace Fl
}

Tw

func (OpSetWordSpacing) Add

func (o OpSetWordSpacing) Add(out *bytes.Buffer)

type OpShFill

type OpShFill struct {
	Shading model.ObjName
}

sh

func (OpShFill) Add

func (o OpShFill) Add(out *bytes.Buffer)

type OpShowSpaceGlyph

type OpShowSpaceGlyph struct {
	Glyphs []SpacedGlyph
}

TJ - OpShowSpaceGlyph is the same as OpShowSpaceText but with input specified as glyph number. This should be used in conjonction with a font using an identity encoding

func (OpShowSpaceGlyph) Add

func (o OpShowSpaceGlyph) Add(out *bytes.Buffer)

type OpShowSpaceText

type OpShowSpaceText struct {
	// Texts store a "normalized version" of texts and spaces
	// SpaceSubtractedAfter fields of 0 are ignored.
	Texts []pdfFonts.TextSpaced
}

TJ - OpShowSpaceText enables font kerning

func (OpShowSpaceText) Add

func (o OpShowSpaceText) Add(out *bytes.Buffer)

type OpShowText

type OpShowText struct {
	Text string // unescaped
}

Tj

func (OpShowText) Add

func (o OpShowText) Add(out *bytes.Buffer)

type OpStroke

type OpStroke struct{}

S

func (OpStroke) Add

func (o OpStroke) Add(out *bytes.Buffer)

type OpTextMove

type OpTextMove struct {
	X, Y Fl
}

Td

func (OpTextMove) Add

func (o OpTextMove) Add(out *bytes.Buffer)

type OpTextMoveSet

type OpTextMoveSet OpTextMove

TD

func (OpTextMoveSet) Add

func (o OpTextMoveSet) Add(out *bytes.Buffer)

type OpTextNextLine

type OpTextNextLine struct{}

T*

func (OpTextNextLine) Add

func (o OpTextNextLine) Add(out *bytes.Buffer)

type OpXObject

type OpXObject struct {
	XObject model.ObjName
}

Do

func (OpXObject) Add

func (o OpXObject) Add(out *bytes.Buffer)

type Operation

type Operation interface {
	Add(out *bytes.Buffer)
}

Operation is a command and its related arguments.

func RoundedRectPath

func RoundedRectPath(x, y, w, h, rTL, rTR, rBR, rBL model.Fl) []Operation

RoundedRectPath returns a rectangle path with rounded corners. The rectangle is of width `w` and height `h`. Its upper left corner is positioned at point (`x`, `y`). The radius for each corner are given by `rTL` (top-left), `rTR` (top-right) `rBR` (bottom-right), `rBL` (bottom-left) (0 means square corners)

type PropertyList

type PropertyList interface {
	// contains filtered or unexported methods
}

PropertyList should be either a Name (refering to the resources dict) or dict object.

type PropertyListDict

type PropertyListDict model.ObjDict

PropertyListDict is a dictionary, where indirect references and streams are not allowed.

type PropertyListName

type PropertyListName model.ObjName

type RGB

type RGB [3]uint8

type RenderingDPI

type RenderingDPI Fl

RenderingDPI specifies a length in DPI

type RenderingDims

type RenderingDims struct {
	Width, Height RenderingSize // See EffectiveSize()
}

RenderingDims defines the size of an image in the page. PDF image objects don't contain such information, which are added via a tranformation matrix associated to the image.

func (RenderingDims) EffectiveSize

func (r RenderingDims) EffectiveSize(img *model.XObjectImage) (width Fl, height Fl)

EffectiveSize performs automatic width and height calculation.

Only the width and height (in terms of columns and rows) of `img` are used.

If both `Width` and `Height` are nil, the image is rendered at 96 dpi. If either `Width` or `Height` is nil, it will be calculated from the other dimension so that the aspect ratio is maintained. Otherwise, `Width` or `Height` may be a dpi or a length.

type RenderingLength

type RenderingLength Fl

RenderingLength specifies a length in user space units.

type RenderingSize

type RenderingSize interface {
	// contains filtered or unexported methods
}

RenderingSize is either RenderingDPI or RenderingLength.

type SpacedGlyph

type SpacedGlyph struct {
	SpaceSubtractedBefore int
	GID                   uint32 // will be hex encoded in the content stream
	SpaceSubtractedAfter  int
}

TJ - OpShowSpaceGlyphs enables font kerning

Jump to

Keyboard shortcuts

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