Struct pdf_writer::Content[][src]

pub struct Content { /* fields omitted */ }
Expand description

A builder for a content stream.

Implementations

Core methods.

Create a new content stream with the default buffer capacity (currently 1 KB).

Create a new content stream with the specified initial buffer capacity.

Start writing an arbitrary operation.

Return the raw constructed byte stream.

General graphics state.

w: Set the stroke line width.

Panics if width is negative.

J: Set the line cap style.

j: Set the line join style.

M: Set the miter limit.

d: Set the line dash pattern.

ri: Set the color rendering intent to the parameter. PDF 1.1+.

i: Set the flatness tolerance in device pixels.

Panics if tolerance is negative or larger than 100.

gs: Set the parameters from an ExtGState dictionary. PDF 1.2+.

Special graphics state.

q: Save the graphics state on the stack.

Q: Restore the graphics state from the stack.

cm: Pre-concatenate the matrix with the current transformation matrix.

Path construction.

m: Begin a new subpath at (x, y).

l: Append a straight line to (x, y).

c: Append a cubic Bézier segment to (x3, y3) with (x1, y1), (x2, y2) as control points.

v: Append a cubic Bézier segment to (x3, y3) with (x2, y2) as control point.

y: Append a cubic Bézier segment to (x3, y3) with (x1, y1) as control point.

h: Close the current subpath with a straight line.

re: Append a rectangle to the current path.

Path painting.

S: Stroke the current path.

s: Close the current path and then stroke it.

f: Fill the current path using the nonzero winding number rule.

f*: Fill the current path using the even-odd rule.

B: Fill the current path using the nonzero winding number rule and then stroke it.

B*: Fill the current path using the even-odd rule and then stroke it.

b: Close the current path, fill it using the nonzero winding number rule and then stroke it.

b*: Close the current path, fill it using the even-odd rule and then stroke it.

n: End the current path without filling or stroking it.

This is primarily used for clipping paths.

Clipping paths.

W: Intersect the current clipping path with the current path using the nonzero winding number rule.

W*: Intersect the current clipping path with the current path using the even-odd rule.

Text objects.

BT: Begin a text object.

ET: End a text object.

Text state.

Tc: Set the character spacing.

Tw: Set the word spacing.

Tz: Set the horizontal scaling.

TL: Set the leading.

Tf: Set font and font size.

Tr: Set the text rendering mode.

Ts: Set the rise.

Text positioning.

Td: Move to the start of the next line.

TD: Move to the start of the next line and set the text state’s leading parameter to -y.

Tm: Set the text matrix.

T*: Move to the start of the next line, determing the vertical offset through the text state’s leading parameter.

Text showing.

Tj: Show text.

The encoding of the text depends on the font.

': Move to the next line and show text.

": Move to the next line, show text and set the text state’s word and character spacing.

TJ: Show text with individual glyph positioning.

Type 3 fonts.

These operators are only allowed in Type 3 CharProcs.

d0: Starts a Type 3 glyph that contains color information.

  • wx defines the glyph’s width
  • wy is set to 0.0 automatically

d1: Starts a Type 3 glyph that contains only shape information.

  • wx defines the glyph’s width
  • wy is set to 0.0 automatically
  • ll_x and ll_y define the lower-left corner of the glyph bounding box
  • ur_x and ur_y define the upper-right corner of the glyph bounding box

Color.

CS: Set the stroke color space to the parameter. PDF 1.1+.

The parameter must be the name of a parameter-less color space or of a color space dictionary within the current resource dictionary.

cs: Set the fill color space to the parameter. PDF 1.1+.

The parameter must be the name of a parameter-less color space or of a color space dictionary within the current resource dictionary.

SCN: Set the stroke color to the parameter within the current color space. PDF 1.2+.

SCN: Set the stroke pattern. PDF 1.2+.

The name parameter is the name of a pattern. If this is an uncolored pattern, a tint color in the current Pattern base color space must be given, otherwise, the color iterator shall remain empty.

scn: Set the fill color to the parameter within the current color space. PDF 1.2+.

scn: Set the fill pattern. PDF 1.2+.

The name parameter is the name of a pattern. If this is an uncolored pattern, a tint color in the current Pattern base color space must be given, otherwise, the color iterator shall remain empty.

G: Set the stroke color to the parameter and the color space to DeviceGray.

g: Set the fill color to the parameter and the color space to DeviceGray.

RG: Set the stroke color to the parameter and the color space to DeviceRGB.

rg: Set the fill color to the parameter and the color space to DeviceRGB.

K: Set the stroke color to the parameter and the color space to DeviceCMYK.

k: Set the fill color to the parameter and the color space to DeviceCMYK.

Shading patterns.

sh: Fill the whole drawing area with the specified shading.

XObjects.

Do: Write an external object.

Compatibility.

BX: Begin a compatability section.

EX: End a compatability section.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.