Class: PDF::Reader::FormXObject

### Home Classes Methods

### In Files

- lib/pdf/reader/form_xobject.rb

### Parent

Object

### Methods

- ::new
- #font_objects
- #raw_content
- #walk

### Included Modules

- PDF::Reader::ResourceMethods

### Files

- MIT-LICENSE
- README.rdoc
- TODO
- mac_expert.txt
- mac_roman.txt
- pdf_doc.txt
- standard.txt
- symbol.txt
- win_ansi.txt
- zapf_dingbats.txt
- glyphlist.txt

### Class/Module Index

Quicksearch

- PDF
- PDF::Reader
- PDF::Reader::Buffer
- PDF::Reader::CidWidths
- PDF::Reader::EncryptedPDFError
- PDF::Reader::Filter
- PDF::Reader::Filter::Ascii85
- PDF::Reader::Filter::AsciiHex
- PDF::Reader::Filter::Depredict
- PDF::Reader::Filter::Flate
- PDF::Reader::Filter::Lzw
- PDF::Reader::Filter::Null
- PDF::Reader::Filter::RunLength
- PDF::Reader::Font
- PDF::Reader::FontDescriptor
- PDF::Reader::FormXObject
- PDF::Reader::InvalidObjectError
- PDF::Reader::MalformedPDFError
- PDF::Reader::ObjectCache
- PDF::Reader::ObjectHash
- PDF::Reader::PageLayout
- PDF::Reader::PageState
- PDF::Reader::PageTextReceiver
- PDF::Reader::Parser
- PDF::Reader::PrintReceiver
- PDF::Reader::Reference
- PDF::Reader::RegisterReceiver
- PDF::Reader::ResourceMethods
- PDF::Reader::StandardSecurityHandler
- PDF::Reader::Stream
- PDF::Reader::SynchronizedCache
- PDF::Reader::TextReceiver
- PDF::Reader::TextRun
- PDF::Reader::TransformationMatrix
- PDF::Reader::UnsupportedFeatureError
- PDF::Reader::WidthCalculator
- PDF::Reader::WidthCalculator::BuiltIn
- PDF::Reader::WidthCalculator::Composite
- PDF::Reader::WidthCalculator::TrueType
- PDF::Reader::WidthCalculator::TypeOneOrThree
- PDF::Reader::WidthCalculator::TypeZero
- PDF::Reader::XRef
- AFM
- AFM::Font

No matching classes.

# PDF::Reader::FormXObject

High level representation of a single PDF form xobject. Form xobjects are contained pieces of content that can be inserted onto multiple pages. They're generally used as a space efficient way to store repetative content (like logos, header, footers, etc).

This behaves and looks much like a limited PDF::Reader::Page class.

### Attributes

xobject[R]

### Public Class Methods

new(page, xobject, options = {}) click to toggle source

    # File lib/pdf/reader/form_xobject.rb, line 19
    def initialize(page, xobject, options = {})
      @page    = page
      @objects = page.objects
      @cache   = options[:cache] || {}
      @xobject = @objects.deref(xobject)
    end

### Public Instance Methods

font_objects() click to toggle source

return a hash of fonts used on this form.

The keys are the font labels used within the form content stream.

The values are a PDF::Reader::Font instances that provide access to most available metrics for each font.

    # File lib/pdf/reader/form_xobject.rb, line 33
    def font_objects
      raw_fonts = @objects.deref(resources[:Font] || {})
      ::Hash[raw_fonts.map { |label, font|
        [label, PDF::Reader::Font.new(@objects, @objects.deref(font))]
      }]
    end

raw_content() click to toggle source

returns the raw content stream for this page. This is plumbing, nothing to see here unless you're a PDF nerd like me.

    # File lib/pdf/reader/form_xobject.rb, line 52
    def raw_content
      @xobject.unfiltered_data
    end

walk(*receivers) click to toggle source

processes the raw content stream for this form in sequential order and passes callbacks to the receiver objects.

See the comments on PDF::Reader::Page#walk for more detail.

    # File lib/pdf/reader/form_xobject.rb, line 45
    def walk(*receivers)
      content_stream(receivers, raw_content)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.