class

PDF::Objects::ExtGState

Inherits PDF::Objects::Base < Reference < Object

Represents a PDF Extended Graphics State (ExtGState) dictionary.

Extended graphics states allow setting graphics state parameters that cannot be set directly in a content stream, such as:

  • Transparency (fill and stroke opacity)
  • Blend modes
  • Overprint settings
  • Line width, cap, join as resources

Usage

# Create an ExtGState for 50% transparency
gs = PDF::Objects::ExtGState.new
gs.fill_opacity = 0.5
gs.stroke_opacity = 0.5
gs.blend_mode = PDF::Content::GraphicsState::BlendMode::Multiply

# Use in page:
page.set_graphics_state(gs)

Constants

TYPE = Name.new("ExtGState")

Type is always ExtGState

Constructors

with_blend_mode(mode : Content::GraphicsState::BlendMode) : ExtGState

Creates an ExtGState with a blend mode.

Source
with_opacity(fill : Float64 | Nil = nil, stroke : Float64 | Nil = nil) : ExtGState

Creates an ExtGState with common opacity settings.

Source

Instance methods

alpha_is_shape

Alpha source flag (AIS)

Source
alpha_is_shape=(alpha_is_shape : Bool | Nil)

Alpha source flag (AIS)

Source
blend_mode

Blend mode (BM)

Source
blend_mode=(blend_mode : Content::GraphicsState::BlendMode | Nil)

Blend mode (BM)

Source
dash_pattern

Dash pattern (D)

Source
dash_pattern=(dash_pattern : Content::GraphicsState::DashPattern | Nil)

Dash pattern (D)

Source
fill_opacity

Fill (non-stroking) opacity (CA/ca) - 0.0 to 1.0

Source
fill_opacity=(fill_opacity : Float64 | Nil)

Fill (non-stroking) opacity (CA/ca) - 0.0 to 1.0

Source
fill_overprint

Fill overprint (op)

Source
fill_overprint=(fill_overprint : Bool | Nil)

Fill overprint (op)

Source
hash_key

Generates a unique key based on the state's properties. Used for deduplication and resource naming.

Source
line_cap

Line cap style (LC)

Source
line_cap=(line_cap : Content::GraphicsState::LineCap | Nil)

Line cap style (LC)

Source
line_join

Line join style (LJ)

Source
line_join=(line_join : Content::GraphicsState::LineJoin | Nil)

Line join style (LJ)

Source
line_width

Line width (LW)

Source
line_width=(line_width : Float64 | Nil)

Line width (LW)

Source
miter_limit

Miter limit (ML)

Source
miter_limit=(miter_limit : Float64 | Nil)

Miter limit (ML)

Source
overprint_mode

Overprint mode (OPM) - 0 or 1

Source
overprint_mode=(overprint_mode : Int32 | Nil)

Overprint mode (OPM) - 0 or 1

Source
rendering_intent

Rendering intent (RI)

Source
rendering_intent=(rendering_intent : Content::GraphicsState::RenderingIntent | Nil)

Rendering intent (RI)

Source
soft_mask

Soft mask (SMask) - Name or dictionary

Source
soft_mask=(soft_mask : Base | Nil)

Soft mask (SMask) - Name or dictionary

Source
stroke_opacity

Stroke opacity (CA) - 0.0 to 1.0

Source
stroke_opacity=(stroke_opacity : Float64 | Nil)

Stroke opacity (CA) - 0.0 to 1.0

Source
stroke_overprint

Stroke overprint (OP)

Source
stroke_overprint=(stroke_overprint : Bool | Nil)

Stroke overprint (OP)

Source
text_knockout

Text knockout flag (TK)

Source
text_knockout=(text_knockout : Bool | Nil)

Text knockout flag (TK)

Source
to_dictionary

Converts to a PDF dictionary.

Source
to_pdf(io : IO) : Nil

Serializes this object to an IO.

By default, this writes the result of #to_pdf to the IO. Subclasses may override for more efficient streaming.

Source
to_pdf

Serializes this object to PDF syntax.

Returns the PDF representation as a string.

Source