### Home Classes Methods

### In Files

- lib/origami/page.rb
- lib/origami/graphics/xobject.rb

### Parent

Origami::Stream

### Methods

- ::new
- #draw_image
- #draw_line
- #draw_polygon
- #draw_rectangle
- #paint_shading
- #render
- #set_dash_pattern
- #set_fill_color
- #set_line_cap
- #set_line_join
- #set_line_width
- #set_stroke_color
- #set_text_char_spacing
- #set_text_font
- #set_text_leading
- #set_text_pos
- #set_text_rendering
- #set_text_rise
- #set_text_scale
- #set_text_word_spacing
- #write

### Class/Module Index

Quicksearch

- Origami
- Origami::Action
- Origami::Action::GoTo
- Origami::Action::GoToE
- Origami::Action::GoToE::EmbeddedTarget
- Origami::Action::GoToE::EmbeddedTarget::Relationship
- Origami::Action::GoToR
- Origami::Action::ImportData
- Origami::Action::JavaScript
- Origami::Action::Launch
- Origami::Action::Launch::WindowsLaunchParams
- Origami::Action::Named
- Origami::Action::RichMediaExecute
- Origami::Action::RichMediaExecute::Command
- Origami::Action::SubmitForm
- Origami::Action::SubmitForm::Flags
- Origami::Action::URI
- Origami::Adobe
- Origami::Adobe::PPKLite
- Origami::Adobe::PPKLite::AddressList
- Origami::Adobe::PPKLite::Catalog
- Origami::Adobe::PPKLite::Certificate
- Origami::Adobe::PPKLite::Certificate::Flags
- Origami::Adobe::PPKLite::Descriptor
- Origami::Adobe::PPKLite::Header
- Origami::Adobe::PPKLite::PPK
- Origami::Adobe::PPKLite::Parser
- Origami::Adobe::PPKLite::Revision
- Origami::Adobe::PPKLite::User
- Origami::Adobe::PPKLite::UserList
- Origami::AnimationStyle3D
- Origami::AnimationStyle3D::Styles
- Origami::Annotation
- Origami::Annotation::AdditionalActions
- Origami::Annotation::AppearanceCharacteristics
- Origami::Annotation::AppearanceCharacteristics::CaptionStyle
- Origami::Annotation::AppearanceDictionary
- Origami::Annotation::AppearanceStream
- Origami::Annotation::Artwork3D
- Origami::Annotation::Artwork3D::Activation
- Origami::Annotation::Artwork3D::Activation::Events
- Origami::Annotation::Artwork3D::Activation::State
- Origami::Annotation::BorderStyle
- Origami::Annotation::Circle
- Origami::Annotation::FileAttachment
- Origami::Annotation::FileAttachment::Icons
- Origami::Annotation::Flags
- Origami::Annotation::FreeText
- Origami::Annotation::FreeText::Intent
- Origami::Annotation::Link
- Origami::Annotation::Link::Highlight
- Origami::Annotation::Markup
- Origami::Annotation::RichMedia
- Origami::Annotation::RichMedia::Activation
- Origami::Annotation::RichMedia::Animation
- Origami::Annotation::RichMedia::Configuration
- Origami::Annotation::RichMedia::Content
- Origami::Annotation::RichMedia::CuePoint
- Origami::Annotation::RichMedia::Deactivation
- Origami::Annotation::RichMedia::Instance
- Origami::Annotation::RichMedia::Parameters
- Origami::Annotation::RichMedia::Parameters::Binding
- Origami::Annotation::RichMedia::Position
- Origami::Annotation::RichMedia::Presentation
- Origami::Annotation::RichMedia::Settings
- Origami::Annotation::RichMedia::Window
- Origami::Annotation::Screen
- Origami::Annotation::Shape
- Origami::Annotation::Sound
- Origami::Annotation::Sound::Icons
- Origami::Annotation::Square
- Origami::Annotation::Text
- Origami::Annotation::Text::TextName
- Origami::Annotation::Triggerable
- Origami::Annotation::Widget
- Origami::Annotation::Widget::Button
- Origami::Annotation::Widget::Button::Flags
- Origami::Annotation::Widget::CheckBox
- Origami::Annotation::Widget::Choice
- Origami::Annotation::Widget::Choice::Flags
- Origami::Annotation::Widget::ComboBox
- Origami::Annotation::Widget::Highlight
- Origami::Annotation::Widget::ListBox
- Origami::Annotation::Widget::PushButton
- Origami::Annotation::Widget::Radio
- Origami::Annotation::Widget::Signature
- Origami::Annotation::Widget::Text
- Origami::Annotation::Widget::Text::Flags
- Origami::Array
- Origami::Background3D
- Origami::Boolean
- Origami::ByteString
- Origami::Catalog
- Origami::CatalogAdditionalActions
- Origami::Console
- Origami::Console::Colors
- Origami::ContentStream
- Origami::CrossSection3D
- Origami::Destination
- Origami::Destination::GlobalBoundingBoxFit
- Origami::Destination::GlobalFit
- Origami::Destination::HorizontalBoudingBoxFit
- Origami::Destination::HorizontalFit
- Origami::Destination::RectangleFit
- Origami::Destination::VerticalBoundingBoxFit
- Origami::Destination::VerticalFit
- Origami::Destination::Zoom
- Origami::DeveloperExtension
- Origami::Dictionary
- Origami::EmbeddedFileParameters
- Origami::EmbeddedFileStream
- Origami::Encoding
- Origami::Encryption
- Origami::Encryption::AES
- Origami::Encryption::ARC4
- Origami::Encryption::CryptFilterDictionary
- Origami::Encryption::EncryptedDocument
- Origami::Encryption::EncryptedObject
- Origami::Encryption::EncryptedStream
- Origami::Encryption::EncryptedString
- Origami::Encryption::EncryptionDictionary
- Origami::Encryption::Identity
- Origami::Encryption::Standard
- Origami::Encryption::Standard::Dictionary
- Origami::Encryption::Standard::Permissions
- Origami::Extensions
- Origami::ExternalFile
- Origami::ExternalStream
- Origami::FDF
- Origami::FDF::Header
- Origami::FDF::Parser
- Origami::FDF::Revision
- Origami::Field
- Origami::Field::Flags
- Origami::Field::Subform
- Origami::Field::Subform::AdditionalActions
- Origami::Field::Subform::CertificateSeedValue
- Origami::Field::Subform::CertificateSeedValue::URL
- Origami::Field::Subform::SignatureLock
- Origami::Field::Subform::SignatureLock::Actions
- Origami::Field::Subform::SignatureSeedValue
- Origami::Field::Subform::SignatureSeedValue::Digest
- Origami::Field::TextAlign
- Origami::Field::Type
- Origami::FileSpec
- Origami::Filename
- Origami::Filter
- Origami::Filter::A85
- Origami::Filter::AHx
- Origami::Filter::ASCII85
- Origami::Filter::ASCIIHex
- Origami::Filter::CCF
- Origami::Filter::CCITTFax
- Origami::Filter::CCITTFax::DecodeParms
- Origami::Filter::ClassMethods
- Origami::Filter::Crypt
- Origami::Filter::Crypt::DecodeParms
- Origami::Filter::DCT
- Origami::Filter::DCT::DecodeParms
- Origami::Filter::Fl
- Origami::Filter::Flate
- Origami::Filter::Flate::DecodeParms
- Origami::Filter::InvalidFlateDataError
- Origami::Filter::JBIG2
- Origami::Filter::JBIG2::DecodeParms
- Origami::Filter::JPX
- Origami::Filter::LZW
- Origami::Filter::LZW::DecodeParms
- Origami::Filter::Predictor
- Origami::Filter::RL
- Origami::Filter::RunLength
- Origami::Filter::Utils
- Origami::Filter::Utils::BitReader
- Origami::Filter::Utils::BitWriter
- Origami::Font
- Origami::Font::TrueType
- Origami::Font::Type1
- Origami::Font::Type1::Standard
- Origami::Font::Type1::Standard::Courier
- Origami::Font::Type1::Standard::CourierBold
- Origami::Font::Type1::Standard::CourierBoldOblique
- Origami::Font::Type1::Standard::CourierOblique
- Origami::Font::Type1::Standard::Helvetica
- Origami::Font::Type1::Standard::HelveticaBold
- Origami::Font::Type1::Standard::HelveticaBoldOblique
- Origami::Font::Type1::Standard::HelveticaOblique
- Origami::Font::Type1::Standard::Symbol
- Origami::Font::Type1::Standard::TimesBold
- Origami::Font::Type1::Standard::TimesBoldItalic
- Origami::Font::Type1::Standard::TimesItalic
- Origami::Font::Type1::Standard::TimesRoman
- Origami::Font::Type1::Standard::ZapfDingbats
- Origami::Font::Type3
- Origami::FontDescriptor
- Origami::FontStream
- Origami::Function
- Origami::Function::Exponential
- Origami::Function::PostScript
- Origami::Function::Sampled
- Origami::Function::Stitching
- Origami::Function::Type
- Origami::Graphics
- Origami::Graphics::Canvas
- Origami::Graphics::Color
- Origami::Graphics::Color::BlendMode
- Origami::Graphics::Color::CMYK
- Origami::Graphics::Color::GrayScale
- Origami::Graphics::Color::ICCProfile
- Origami::Graphics::Color::Intent
- Origami::Graphics::Color::RGB
- Origami::Graphics::Color::Space
- Origami::Graphics::DashPattern
- Origami::Graphics::DummyCanvas
- Origami::Graphics::ExtGState
- Origami::Graphics::FormXObject
- Origami::Graphics::ImageXObject
- Origami::Graphics::InvalidColorError
- Origami::Graphics::InvalidPathError
- Origami::Graphics::LineCapStyle
- Origami::Graphics::LineJoinStyle
- Origami::Graphics::Path
- Origami::Graphics::Path::Line
- Origami::Graphics::Path::Segment
- Origami::Graphics::Pattern
- Origami::Graphics::Pattern::Shading
- Origami::Graphics::Pattern::Shading::Axial
- Origami::Graphics::Pattern::Shading::CoonsPathMesh
- Origami::Graphics::Pattern::Shading::FreeFormTriangleMesh
- Origami::Graphics::Pattern::Shading::FunctionBased
- Origami::Graphics::Pattern::Shading::LatticeFormTriangleMesh
- Origami::Graphics::Pattern::Shading::Radial
- Origami::Graphics::Pattern::Shading::ShadingObject
- Origami::Graphics::Pattern::Shading::TensorProductPatchMesh
- Origami::Graphics::Pattern::Shading::Type
- Origami::Graphics::Pattern::Tiling
- Origami::Graphics::Pattern::Tiling::PaintType
- Origami::Graphics::Pattern::Tiling::Type
- Origami::Graphics::Pattern::Type
- Origami::Graphics::ReferenceDictionary
- Origami::Graphics::State
- Origami::Graphics::TextCanvas
- Origami::Graphics::XObject
- Origami::HexaString
- Origami::HintStream
- Origami::HintTable
- Origami::HintTable::ClassMethods
- Origami::HintTable::PageOffsetTable
- Origami::HintTable::SharedObjectTable
- Origami::Integer
- Origami::InteractiveForm
- Origami::InteractiveForm::SigFlags
- Origami::InvalidPDFInstructionError
- Origami::InvalidXRefStreamObjectError
- Origami::LightingScheme3D
- Origami::LightingScheme3D::Styles
- Origami::Linearization
- Origami::Metadata
- Origami::MetadataStream
- Origami::Name
- Origami::NameLeaf
- Origami::NameTreeNode
- Origami::Names
- Origami::Names::Root
- Origami::NavigationNode
- Origami::Node3D
- Origami::Null
- Origami::Number
- Origami::Obfuscator
- Origami::Object
- Origami::ObjectStream
- Origami::Outline
- Origami::OutlineItem
- Origami::OutlineItem::Style
- Origami::OutputIntent
- Origami::OutputIntent::Intent
- Origami::PDF
- Origami::PDF::Header
- Origami::PDF::Instruction
- Origami::PDF::JavaScript
- Origami::PDF::JavaScript::AcroTimer
- Origami::PDF::JavaScript::AcrobatObject
- Origami::PDF::JavaScript::Acrohelp
- Origami::PDF::JavaScript::App
- Origami::PDF::JavaScript::Arg
- Origami::PDF::JavaScript::Console
- Origami::PDF::JavaScript::Data
- Origami::PDF::JavaScript::Doc
- Origami::PDF::JavaScript::Doc::Info
- Origami::PDF::JavaScript::Engine
- Origami::PDF::JavaScript::EngineError
- Origami::PDF::JavaScript::Field
- Origami::PDF::JavaScript::GeneralError
- Origami::PDF::JavaScript::Global
- Origami::PDF::JavaScript::HelpError
- Origami::PDF::JavaScript::Interval
- Origami::PDF::JavaScript::InvalidArgsError
- Origami::PDF::JavaScript::MissingArgError
- Origami::PDF::JavaScript::NotAllowedError
- Origami::PDF::JavaScript::Platforms
- Origami::PDF::JavaScript::ReadStream
- Origami::PDF::JavaScript::TimeOut
- Origami::PDF::JavaScript::TypeError
- Origami::PDF::JavaScript::Util
- Origami::PDF::JavaScript::Viewers
- Origami::PDF::LinearParser
- Origami::PDF::Parser
- Origami::PDF::Revision
- Origami::Page
- Origami::Page::Format
- Origami::PageAdditionalActions
- Origami::PageTreeNode
- Origami::Perms
- Origami::Projection3D
- Origami::Projection3D::ClippingStyles
- Origami::Projection3D::Scaling
- Origami::Real
- Origami::Rectangle
- Origami::Reference
- Origami::Reference3D
- Origami::RenderMode3D
- Origami::RenderMode3D::Modes
- Origami::Requirement
- Origami::Requirement::Handler
- Origami::Requirement::Handler::Type
- Origami::Resources
- Origami::ResourcesHolder
- Origami::Signature
- Origami::Signature::AppData
- Origami::Signature::BuildData
- Origami::Signature::BuildProperties
- Origami::Signature::DigitalSignature
- Origami::Signature::Reference
- Origami::Signature::SigQData
- Origami::Stream
- Origami::String
- Origami::String::Encoding
- Origami::String::Encoding::PDFDocEncoding
- Origami::String::Encoding::UTF16BE
- Origami::Text
- Origami::Text::Rendering
- Origami::Text::State
- Origami::Trailer
- Origami::U3DStream
- Origami::URL
- Origami::UsageRights
- Origami::UsageRights::Rights
- Origami::UsageRights::TransformParams
- Origami::V8
- Origami::V8::Object
- Origami::View3D
- Origami::ViewerPreferences
- Origami::Webcapture
- Origami::Webcapture::Command
- Origami::Webcapture::Command::Flags
- Origami::Webcapture::CommandSettings
- Origami::Webcapture::SourceInformation
- Origami::Webcapture::SourceInformation::SubmissionType
- Origami::Webcapture::SpiderInfo
- Origami::XDP
- Origami::XDP::Package
- Origami::XDP::Packet
- Origami::XDP::Packet::Config
- Origami::XDP::Packet::Config::AdjustData
- Origami::XDP::Packet::Config::Attributes
- Origami::XDP::Packet::Config::Base
- Origami::XDP::Packet::Config::Common
- Origami::XDP::Packet::Config::Data
- Origami::XDP::Packet::Config::Debug
- Origami::XDP::Packet::Config::ExcludeNS
- Origami::XDP::Packet::Config::GroupParent
- Origami::XDP::Packet::Config::IfEmpty
- Origami::XDP::Packet::Config::IncrementalLoad
- Origami::XDP::Packet::Config::Locale
- Origami::XDP::Packet::Config::LocaleSet
- Origami::XDP::Packet::Config::Log
- Origami::XDP::Packet::Config::Message
- Origami::XDP::Packet::Config::Messaging
- Origami::XDP::Packet::Config::Mode
- Origami::XDP::Packet::Config::MsgId
- Origami::XDP::Packet::Config::NameAttr
- Origami::XDP::Packet::Config::OutputXSL
- Origami::XDP::Packet::Config::Picture
- Origami::XDP::Packet::Config::Presence
- Origami::XDP::Packet::Config::Range
- Origami::XDP::Packet::Config::Record
- Origami::XDP::Packet::Config::Relevant
- Origami::XDP::Packet::Config::Rename
- Origami::XDP::Packet::Config::Severity
- Origami::XDP::Packet::Config::StartNode
- Origami::XDP::Packet::Config::StartPage
- Origami::XDP::Packet::Config::SuppressBanner
- Origami::XDP::Packet::Config::Template
- Origami::XDP::Packet::Config::Threshold
- Origami::XDP::Packet::Config::To
- Origami::XDP::Packet::Config::Transform
- Origami::XDP::Packet::Config::URI
- Origami::XDP::Packet::Config::ValidationMessaging
- Origami::XDP::Packet::Config::VersionControl
- Origami::XDP::Packet::Config::Whitespace
- Origami::XDP::Packet::Config::Window
- Origami::XDP::Packet::Config::XSL
- Origami::XDP::Packet::ConnectionSet
- Origami::XDP::Packet::ConnectionSet::EffectiveInputPolicy
- Origami::XDP::Packet::ConnectionSet::EffectiveOutputPolicy
- Origami::XDP::Packet::ConnectionSet::Operation
- Origami::XDP::Packet::ConnectionSet::RootElement
- Origami::XDP::Packet::ConnectionSet::SOAPAction
- Origami::XDP::Packet::ConnectionSet::SOAPAddress
- Origami::XDP::Packet::ConnectionSet::URI
- Origami::XDP::Packet::ConnectionSet::WSDLAddress
- Origami::XDP::Packet::ConnectionSet::WSDLConnection
- Origami::XDP::Packet::ConnectionSet::XMLConnection
- Origami::XDP::Packet::ConnectionSet::XSDConnection
- Origami::XDP::Packet::Datasets
- Origami::XDP::Packet::Datasets::Data
- Origami::XDP::Packet::LocaleSet
- Origami::XDP::Packet::PDF
- Origami::XDP::Packet::Signature
- Origami::XDP::Packet::SourceSet
- Origami::XDP::Packet::StyleSheet
- Origami::XDP::Packet::Template
- Origami::XDP::Packet::Template::AppearanceFilter
- Origami::XDP::Packet::Template::Arc
- Origami::XDP::Packet::Template::Area
- Origami::XDP::Packet::Template::Assist
- Origami::XDP::Packet::Template::Barcode
- Origami::XDP::Packet::Template::Bind
- Origami::XDP::Packet::Template::BindItems
- Origami::XDP::Packet::Template::Bookend
- Origami::XDP::Packet::Template::Boolean
- Origami::XDP::Packet::Template::Border
- Origami::XDP::Packet::Template::Break
- Origami::XDP::Packet::Template::BreakAfter
- Origami::XDP::Packet::Template::BreakBefore
- Origami::XDP::Packet::Template::Button
- Origami::XDP::Packet::Template::Calculate
- Origami::XDP::Packet::Template::Caption
- Origami::XDP::Packet::Template::Certificate
- Origami::XDP::Packet::Template::Certificates
- Origami::XDP::Packet::Template::CheckButton
- Origami::XDP::Packet::Template::ChoiceList
- Origami::XDP::Packet::Template::Color
- Origami::XDP::Packet::Template::Comb
- Origami::XDP::Packet::Template::Connect
- Origami::XDP::Packet::Template::ContentArea
- Origami::XDP::Packet::Template::Corner
- Origami::XDP::Packet::Template::Date
- Origami::XDP::Packet::Template::DateTime
- Origami::XDP::Packet::Template::DateTimeEdit
- Origami::XDP::Packet::Template::Decimal
- Origami::XDP::Packet::Template::DefaultUI
- Origami::XDP::Packet::Template::Desc
- Origami::XDP::Packet::Template::DigestMethod
- Origami::XDP::Packet::Template::DigestMethods
- Origami::XDP::Packet::Template::Draw
- Origami::XDP::Packet::Template::Edge
- Origami::XDP::Packet::Template::Encoding
- Origami::XDP::Packet::Template::Encodings
- Origami::XDP::Packet::Template::Encrypt
- Origami::XDP::Packet::Template::Event
- Origami::XDP::Packet::Template::ExData
- Origami::XDP::Packet::Template::ExObject
- Origami::XDP::Packet::Template::ExclGroup
- Origami::XDP::Packet::Template::Execute
- Origami::XDP::Packet::Template::Extras
- Origami::XDP::Packet::Template::Field
- Origami::XDP::Packet::Template::Fill
- Origami::XDP::Packet::Template::Filter
- Origami::XDP::Packet::Template::Float
- Origami::XDP::Packet::Template::Font
- Origami::XDP::Packet::Template::FormCalcScript
- Origami::XDP::Packet::Template::Format
- Origami::XDP::Packet::Template::Handler
- Origami::XDP::Packet::Template::Hyphenation
- Origami::XDP::Packet::Template::Image
- Origami::XDP::Packet::Template::ImageEdit
- Origami::XDP::Packet::Template::Integer
- Origami::XDP::Packet::Template::Issuers
- Origami::XDP::Packet::Template::Items
- Origami::XDP::Packet::Template::JavaScript
- Origami::XDP::Packet::Template::Keep
- Origami::XDP::Packet::Template::KeyUsage
- Origami::XDP::Packet::Template::Line
- Origami::XDP::Packet::Template::Linear
- Origami::XDP::Packet::Template::LockDocument
- Origami::XDP::Packet::Template::MDP
- Origami::XDP::Packet::Template::Manifest
- Origami::XDP::Packet::Template::Margin
- Origami::XDP::Packet::Template::Medium
- Origami::XDP::Packet::Template::Message
- Origami::XDP::Packet::Template::NumericEdit
- Origami::XDP::Packet::Template::OID
- Origami::XDP::Packet::Template::OIDs
- Origami::XDP::Packet::Template::Occur
- Origami::XDP::Packet::Template::Overflow
- Origami::XDP::Packet::Template::PageArea
- Origami::XDP::Packet::Template::PageSet
- Origami::XDP::Packet::Template::Para
- Origami::XDP::Packet::Template::PasswordEdit
- Origami::XDP::Packet::Template::Pattern
- Origami::XDP::Packet::Template::Picture
- Origami::XDP::Packet::Template::Proto
- Origami::XDP::Packet::Template::Radial
- Origami::XDP::Packet::Template::Reason
- Origami::XDP::Packet::Template::Reasons
- Origami::XDP::Packet::Template::Rectangle
- Origami::XDP::Packet::Template::Ref
- Origami::XDP::Packet::Template::Script
- Origami::XDP::Packet::Template::SetProperty
- Origami::XDP::Packet::Template::SignData
- Origami::XDP::Packet::Template::Signature
- Origami::XDP::Packet::Template::Signing
- Origami::XDP::Packet::Template::Solid
- Origami::XDP::Packet::Template::Speak
- Origami::XDP::Packet::Template::Stipple
- Origami::XDP::Packet::Template::Subform
- Origami::XDP::Packet::Template::SubformSet
- Origami::XDP::Packet::Template::SubjectDN
- Origami::XDP::Packet::Template::SubjectDNs
- Origami::XDP::Packet::Template::Submit
- Origami::XDP::Packet::Template::Text
- Origami::XDP::Packet::Template::TextEdit
- Origami::XDP::Packet::Template::Time
- Origami::XDP::Packet::Template::TimeStamp
- Origami::XDP::Packet::Template::ToolTip
- Origami::XDP::Packet::Template::Traversal
- Origami::XDP::Packet::Template::Traverse
- Origami::XDP::Packet::Template::UI
- Origami::XDP::Packet::Template::Validate
- Origami::XDP::Packet::Template::Value
- Origami::XDP::Packet::Template::Variables
- Origami::XDP::Packet::XDC
- Origami::XDP::Packet::XFDF
- Origami::XDP::Packet::XMPMeta
- Origami::XDP::XDP
- Origami::XFA
- Origami::XFA::ClassMethods
- Origami::XFA::Element
- Origami::XRef
- Origami::XRef::Section
- Origami::XRef::Subsection
- Origami::XRefStream
- Origami::XRefToCompressedObj
- EmptySymbol
- Fixnum
- Hash

No matching classes.

# Origami::ContentStream

Forward declaration.

A class representing a Stream containing the contents of a Page.

### Constants

DEFAULT_DASHPATTERN
DEFAULT_FILL_COLOR
DEFAULT_FONT
DEFAULT_LEADING
DEFAULT_LINECAP
DEFAULT_LINEJOIN
DEFAULT_LINEWIDTH
DEFAULT_SIZE
DEFAULT_STROKE_COLOR

### Attributes

canvas[RW]
instructions[R]

### Public Class Methods

new(rawdata = "", dictionary = {}) click to toggle source

    # File lib/origami/graphics/xobject.rb, line 46
    def initialize(rawdata = "", dictionary = {})

      @instructions = nil
      @canvas = Graphics::DummyCanvas.new

      super(rawdata, dictionary)
    end

### Public Instance Methods

draw_image(name, attr = {}) click to toggle source

    # File lib/origami/graphics/xobject.rb, line 81
    def draw_image(name, attr = {})
      load! if @instructions.nil?

      x, y = attr[:x], attr[:y]

      @instructions << PDF::Instruction.new('q')
      @instructions << PDF::Instruction.new('cm', 300, 0, 0, 300, x, y)
      @instructions << PDF::Instruction.new('Do', name)
      @instructions << PDF::Instruction.new('Q')
    end

draw_line(from, to, attr = {}) click to toggle source

Draw a straight line from the point at coord from, to the point at coord to.

    # File lib/origami/graphics/xobject.rb, line 95
    def draw_line(from, to, attr = {})
      draw_polygon([from, to], attr)
    end

draw_polygon(coords = [], attr = {}) click to toggle source

Draw a polygon from a array of coordinates.

    # File lib/origami/graphics/xobject.rb, line 102
    def draw_polygon(coords = [], attr = {})
      load! if @instructions.nil?

      stroke_color  = attr[:stroke_color] || DEFAULT_STROKE_COLOR
      fill_color    = attr[:fill_color] || DEFAULT_FILL_COLOR
      line_cap      = attr[:line_cap] || DEFAULT_LINECAP
      line_join     = attr[:line_join] || DEFAULT_LINEJOIN
      line_width    = attr[:line_width] || DEFAULT_LINEWIDTH
      dash_pattern  = attr[:dash] || DEFAULT_DASHPATTERN

      stroke        = attr[:stroke].nil? ? true : attr[:stroke]
      fill          = attr[:fill].nil? ? false : attr[:fill]

      stroke = true if fill == false and stroke == false

      set_fill_color(fill_color) if fill
      set_stroke_color(stroke_color) if stroke
      set_line_width(line_width)
      set_line_cap(line_cap)
      set_line_join(line_join)
      set_dash_pattern(dash_pattern)

      if @canvas.gs.text_state.is_in_text_object?
        @instructions << PDF::Instruction.new('ET').render(@canvas)
      end

      unless coords.size < 1
        x,y = coords.slice!(0)
        @instructions << PDF::Instruction.new('m',x,y).render(@canvas)

        coords.each do |px,py|
          @instructions << PDF::Instruction.new('l',px,py).render(@canvas)
        end

        @instructions << (i =
          if stroke and not fill
            PDF::Instruction.new('s')
          elsif fill and not stroke
            PDF::Instruction.new('f')
          elsif fill and stroke
            PDF::Instruction.new('b')
          end
        )

        i.render(@canvas)
      end

      self
    end

draw_rectangle(x, y, width, height, attr = {}) click to toggle source

Draw a rectangle at position (x,y) with defined width and height.

    # File lib/origami/graphics/xobject.rb, line 155
    def draw_rectangle(x, y, width, height, attr = {})
      load! if @instructions.nil?

      stroke_color  = attr[:stroke_color] || DEFAULT_STROKE_COLOR
      fill_color    = attr[:fill_color] || DEFAULT_FILL_COLOR
      line_cap      = attr[:line_cap] || DEFAULT_LINECAP
      line_join     = attr[:line_join] || DEFAULT_LINEJOIN
      line_width    = attr[:line_width] || DEFAULT_LINEWIDTH
      dash_pattern  = attr[:dash] || DEFAULT_DASHPATTERN

      stroke        = attr[:stroke].nil? ? true : attr[:stroke]
      fill          = attr[:fill].nil? ? false : attr[:fill]

      stroke = true if fill == false and stroke == false

      set_fill_color(fill_color) if fill
      set_stroke_color(stroke_color) if stroke
      set_line_width(line_width)
      set_line_cap(line_cap)
      set_line_join(line_join)
      set_dash_pattern(dash_pattern)

      if @canvas.gs.text_state.is_in_text_object?
        @instructions << PDF::Instruction.new('ET').render(@canvas)
      end

      @instructions << PDF::Instruction.new('re', x,y,width,height).render(@canvas)

      @instructions << (i =
        if stroke and not fill
          PDF::Instruction.new('S')
        elsif fill and not stroke
          PDF::Instruction.new('f')
        elsif fill and stroke
          PDF::Instruction.new('B')
        end
      )

      i.render(@canvas)

      self
    end

paint_shading(shade) click to toggle source

    # File lib/origami/graphics/xobject.rb, line 242
    def paint_shading(shade)
      load! if @instructions.nil?
      @instructions << PDF::Instruction.new('sh', shade).render(@canvas)

      self
    end

render(engine) click to toggle source

    # File lib/origami/graphics/xobject.rb, line 54
    def render(engine)
      load! if @instructions.nil?

      @instructions.each do |instruction|
        instruction.render(engine)
      end

      nil
    end

set_dash_pattern(pattern) click to toggle source

    # File lib/origami/graphics/xobject.rb, line 379
    def set_dash_pattern(pattern)
      load! if @instructions.nil?
      unless @canvas.gs.dash_pattern.eql? pattern
        @instructions << PDF::Instruction.new('d', pattern.array, pattern.phase).render(@canvas)
      end

      self
    end

set_fill_color(color) click to toggle source

    # File lib/origami/graphics/xobject.rb, line 319
    def set_fill_color(color)
      load! if @instructions.nil?

      @instructions << ( i =
        if (color.respond_to? :r and color.respond_to? :g and color.respond_to? :b) or (color.is_a?(::Array) and color.size == 3)
          r = (color.respond_to?(:r) ? color.r : color[0]).to_f / 255
          g = (color.respond_to?(:g) ? color.g : color[1]).to_f / 255
          b = (color.respond_to?(:b) ? color.b : color[2]).to_f / 255
          PDF::Instruction.new('rg', r, g, b) if @canvas.gs.nonstroking_color != [r,g,b]

        elsif (color.respond_to? :c and color.respond_to? :m and color.respond_to? :y and color.respond_to? :k) or (color.is_a?(::Array) and color.size == 4)
          c = (color.respond_to?(:c) ? color.c : color[0]).to_f
          m = (color.respond_to?(:m) ? color.m : color[1]).to_f
          y = (color.respond_to?(:y) ? color.y : color[2]).to_f
          k = (color.respond_to?(:k) ? color.k : color[3]).to_f
          PDF::Instruction.new('k', c, m, y, k) if @canvas.gs.nonstroking_color != [c,m,y,k]

        elsif color.respond_to?:g or (0.0..1.0) === color
          g = color.respond_to?(:g) ? color.g : color
          PDF::Instruction.new('g', g) if @canvas.gs.nonstroking_color != [ g ]

        else
          raise TypeError, "Invalid color : #{color}"
        end
      )

      i.render(@canvas) if i
      self
    end

set_line_cap(cap) click to toggle source

    # File lib/origami/graphics/xobject.rb, line 397
    def set_line_cap(cap)
      load! if @instructions.nil?
      if @canvas.gs.line_cap != cap
        @instructions << PDF::Instruction.new('J', cap).render(@canvas)
      end

      self
    end

set_line_join(join) click to toggle source

    # File lib/origami/graphics/xobject.rb, line 406
    def set_line_join(join)
      load! if @instructions.nil?
      if @canvas.gs.line_join != join
        @instructions << PDF::Instruction.new('j', join).render(@canvas)
      end

      self
    end

set_line_width(width) click to toggle source

    # File lib/origami/graphics/xobject.rb, line 388
    def set_line_width(width)
      load! if @instructions.nil?
      if @canvas.gs.line_width != width
        @instructions << PDF::Instruction.new('w', width).render(@canvas)
      end

      self
    end

set_stroke_color(color) click to toggle source

    # File lib/origami/graphics/xobject.rb, line 349
    def set_stroke_color(color)
      load! if @instructions.nil?

      @instructions << ( i =
        if (color.respond_to? :r and color.respond_to? :g and color.respond_to? :b) or (color.is_a?(::Array) and color.size == 3)
          r = (color.respond_to?(:r) ? color.r : color[0]).to_f / 255
          g = (color.respond_to?(:g) ? color.g : color[1]).to_f / 255
          b = (color.respond_to?(:b) ? color.b : color[2]).to_f / 255
          PDF::Instruction.new('RG', r, g, b) if @canvas.gs.stroking_color != [r,g,b]

        elsif (color.respond_to? :c and color.respond_to? :m and color.respond_to? :y and color.respond_to? :k) or (color.is_a?(::Array) and color.size == 4)
          c = (color.respond_to?(:c) ? color.c : color[0]).to_f
          m = (color.respond_to?(:m) ? color.m : color[1]).to_f
          y = (color.respond_to?(:y) ? color.y : color[2]).to_f
          k = (color.respond_to?(:k) ? color.k : color[3]).to_f
          PDF::Instruction.new('K', c, m, y, k) if @canvas.gs.stroking_color != [c,m,y,k]

        elsif color.respond_to?:g or (0.0..1.0) === color
          g = color.respond_to?(:g) ? color.g : color
          PDF::Instruction.new('G', g) if @canvas.gs.stroking_color != [ g ]

        else
          raise TypeError, "Invalid color : #{color}"
        end
      )

      i.render(@canvas) if i
      self
    end

set_text_char_spacing(char_spacing) click to toggle source

    # File lib/origami/graphics/xobject.rb, line 310
    def set_text_char_spacing(char_spacing)
      load! if @instructions.nil?
      if char_spacing != @canvas.gs.text_state.char_spacing
        @instructions << PDF::Instruction.new('Tc', char_spacing).render(@canvas)
      end

      self
    end

set_text_font(fontname, size) click to toggle source

    # File lib/origami/graphics/xobject.rb, line 249
    def set_text_font(fontname, size)
      load! if @instructions.nil?
      if fontname != @canvas.gs.text_state.font or size != @canvas.gs.text_state.font_size
        @instructions << PDF::Instruction.new('Tf', fontname, size).render(@canvas)
      end

      self
    end

set_text_leading(leading) click to toggle source

    # File lib/origami/graphics/xobject.rb, line 265
    def set_text_leading(leading)
      load! if @instructions.nil?
      if leading != @canvas.gs.text_state.leading
        @instructions << PDF::Instruction.new('TL', leading).render(@canvas)
      end

      self
    end

set_text_pos(tx,ty) click to toggle source

    # File lib/origami/graphics/xobject.rb, line 258
    def set_text_pos(tx,ty)
      load! if @instructions.nil?
      @instructions << PDF::Instruction.new('Td', tx, ty).render(@canvas)

      self
    end

set_text_rendering(rendering) click to toggle source

    # File lib/origami/graphics/xobject.rb, line 274
    def set_text_rendering(rendering)
      load! if @instructions.nil?
      if rendering != @canvas.gs.text_state.rendering_mode
        @instructions << PDF::Instruction.new('Tr', rendering).render(@canvas)
      end

      self
    end

set_text_rise(rise) click to toggle source

    # File lib/origami/graphics/xobject.rb, line 283
    def set_text_rise(rise)
      load! if @instructions.nil?
      if rise != @canvas.gs.text_state.text_rise
        @instructions << PDF::Instruction.new('Ts', rise).render(@canvas)
      end

      self
    end

set_text_scale(scaling) click to toggle source

    # File lib/origami/graphics/xobject.rb, line 292
    def set_text_scale(scaling)
      load! if @instructions.nil?
      if scale != @canvas.gs.text_state.scaling
        @instructions << PDF::Instruction.new('Tz', scaling).render(@canvas)
      end

      self
    end

set_text_word_spacing(word_spacing) click to toggle source

    # File lib/origami/graphics/xobject.rb, line 301
    def set_text_word_spacing(word_spacing)
      load! if @instructions.nil?
      if word_spacing != @canvas.gs.text_state.word_spacing
        @instructions << PDF::Instruction.new('Tw', word_spacing).render(@canvas)
      end

      self
    end

write(text, attr = {}) click to toggle source

Adds text to the content stream with custom formatting attributes.

text | Text to write.
attr | Formatting attributes.

    # File lib/origami/graphics/xobject.rb, line 203
    def write(text, attr = {})
      load! if @instructions.nil?

      x,y       = attr[:x], attr[:y]
      font      = attr[:font] || DEFAULT_FONT
      size      = attr[:size] || DEFAULT_SIZE
      leading   = attr[:leading] || DEFAULT_LEADING
      color     = attr[:color] || attr[:fill_color] || DEFAULT_STROKE_COLOR
      stroke_color = attr[:stroke_color] || DEFAULT_STROKE_COLOR
      line_width    = attr[:line_width] || DEFAULT_LINEWIDTH
      word_spacing  = attr[:word_spacing]
      char_spacing  = attr[:char_spacing]
      scale     = attr[:scale]
      rise      = attr[:rise]
      rendering = attr[:rendering]

      @instructions << PDF::Instruction.new('ET').render(@canvas) if (x or y) and @canvas.gs.text_state.is_in_text_object?

      unless @canvas.gs.text_state.is_in_text_object?
        @instructions << PDF::Instruction.new('BT').render(@canvas)
      end

      set_text_font(font, size)
      set_text_pos(x, y) if x or y
      set_text_leading(leading) if leading
      set_text_rendering(rendering) if rendering
      set_text_rise(rise) if rise
      set_text_scale(scale) if scale
      set_text_word_spacing(word_spacing) if word_spacing
      set_text_char_spacing(char_spacing) if char_spacing
      set_fill_color(color)
      set_stroke_color(stroke_color)
      set_line_width(line_width)

      write_text_block(text)

      self
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.