### Home Classes Methods

### In Files

- lib/prawn/name_tree.rb
- lib/prawn/font/ttf.rb
- lib/prawn/font/dfont.rb
- lib/prawn/font/afm.rb
- lib/prawn/core.rb
- lib/prawn/encoding.rb
- lib/prawn/byte_string.rb
- lib/prawn/text/box.rb
- lib/prawn/text.rb
- lib/prawn/graphics.rb
- lib/prawn/repeater.rb
- lib/prawn/pdf_object.rb
- lib/prawn/literal_string.rb
- lib/prawn/core/text.rb
- lib/prawn/core/object_store.rb
- lib/prawn/core/page.rb
- lib/prawn/images/jpg.rb
- lib/prawn/images/png.rb
- lib/prawn/stamp.rb
- lib/prawn/measurements.rb
- lib/prawn/reference.rb
- lib/prawn/images.rb
- lib/prawn/errors.rb
- lib/prawn/document.rb
- lib/prawn/outline.rb
- lib/prawn/document/column_box.rb
- lib/prawn/document/internals.rb
- lib/prawn/document/snapshot.rb
- lib/prawn/document/span.rb
- lib/prawn/document/annotations.rb
- lib/prawn/document/destinations.rb
- lib/prawn/document/bounding_box.rb
- lib/prawn/document/graphics_state.rb
- lib/prawn/document/page_geometry.rb
- lib/prawn/graphics/join_style.rb
- lib/prawn/graphics/dash.rb
- lib/prawn/graphics/cap_style.rb
- lib/prawn/graphics/transformation.rb
- lib/prawn/graphics/color.rb
- lib/prawn/graphics/transparency.rb
- lib/prawn/font.rb

### Namespace

- MODULE Prawn::Core
- MODULE Prawn::Encoding
- MODULE Prawn::Errors
- MODULE Prawn::Graphics
- MODULE Prawn::Images
- MODULE Prawn::Measurements
- MODULE Prawn::Stamp
- MODULE Prawn::Text
- CLASS Prawn::Document
- CLASS Prawn::Font
- CLASS Prawn::Outline

### Methods

- #PdfObject

### Files

- COPYING
- HACKING
- LICENSE
- README

### Class/Module Index

Quicksearch

- Prawn
- Prawn::Core
- Prawn::Document
- Prawn::Document::Annotations
- Prawn::Document::BoundingBox
- Prawn::Document::ColumnBox
- Prawn::Document::Destinations
- Prawn::Document::GraphicsState
- Prawn::Document::Internals
- Prawn::Document::PageGeometry
- Prawn::Document::Snapshot
- Prawn::Encoding
- Prawn::Errors
- Prawn::Font
- Prawn::Font::AFM
- Prawn::Font::DFont
- Prawn::Font::TTF
- Prawn::Graphics
- Prawn::Graphics::CapStyle
- Prawn::Graphics::Color
- Prawn::Graphics::Dash
- Prawn::Graphics::JoinStyle
- Prawn::Graphics::Transformation
- Prawn::Graphics::Transparency
- Prawn::Images
- Prawn::Images::JPG
- Prawn::Images::PNG
- Prawn::Measurements
- Prawn::Outline
- Prawn::Stamp
- Prawn::Text
- Prawn::Text::Box
- Prawn::Text::LineWrap
- File
- Numeric

No matching classes.

# Prawn

Copyright September 2008, Gregory Brown, James Healy All Rights Reserved.

This is free software. Please see the LICENSE and COPYING files for details.

text/box.rb : Implements text boxes

Copyright November 2009, Daniel Nelson. All Rights Reserved.

This is free software. Please see the LICENSE and COPYING files for details.

repeater.rb : Implements repeated page elements. Heavy inspired by repeating_element() in PDF::Wrapper

    http://pdf-wrapper.rubyforge.org/

Copyright November 2009, Gregory Brown. All Rights Reserved.

This is free software. Please see the LICENSE and COPYING files for details.

Top level Module

prawn/core/object_store.rb : Implements PDF object repository for Prawn

Copyright August 2009, Brad Ediger. All Rights Reserved.

This is free software. Please see the LICENSE and COPYING files for details.

prawn/core/page.rb : Implements low-level representation of a PDF page

Copyright February 2010, Gregory Brown. All Rights Reserved.

This is free software. Please see the LICENSE and COPYING files for details.

stamp.rb : Implements a repeatable stamp

Copyright October 2009, Daniel Nelson. All Rights Reserved.

This is free software. Please see the LICENSE and COPYING files for details.

measurements.rb: Conversions from other measurements to PDF points

Copyright December 2008, Florian Witteler. All Rights Reserved.

errors.rb : Implements custom error classes for Prawn

Copyright April 2008, Gregory Brown. All Rights Reserved.

This is free software. Please see the LICENSE and COPYING files for details.

internals.rb : Implements document internals for Prawn

Copyright August 2008, Gregory Brown. All Rights Reserved.

This is free software. Please see the LICENSE and COPYING files for details.

span.rb : Implements text columns

Copyright September 2008, Gregory Brown. All Rights Reserved.

This is free software. Please see the LICENSE and COPYING files for details.

bounding_box.rb : Implements a mechanism for shifting the coordinate space

Copyright May 2008, Gregory Brown. All Rights Reserved.

This is free software. Please see the LICENSE and COPYING files for details.

graphics_state.rb: Implements graphics state saving and restoring

Copyright January 2010, Michael Witrant. All Rights Reserved.

This is free software. Please see the LICENSE and COPYING files for details.

page_geometry.rb : Describes PDF page geometries

Copyright April 2008, Gregory Brown. All Rights Reserved.

This is free software. Please see the LICENSE and COPYING files for details.

join_style.rb : Implements stroke join styling

Contributed by Daniel Nelson. October, 2009

This is free software. Please see the LICENSE and COPYING files for details.

dash.rb : Implements stroke dashing

Contributed by Daniel Nelson. October, 2009

This is free software. Please see the LICENSE and COPYING files for details.

cap_style.rb : Implements stroke cap styling

Contributed by Daniel Nelson. October, 2009

This is free software. Please see the LICENSE and COPYING files for details.

transformation.rb: Implements rotate, translate, skew, scale and a generic

    transformation_matrix

Copyright January 2010, Michael Witrant. All Rights Reserved.

This is free software. Please see the LICENSE and COPYING files for details.

color.rb : Implements color handling

Copyright June 2008, Gregory Brown. All Rights Reserved.

This is free software. Please see the LICENSE and COPYING files for details.

transparency.rb : Implements transparency

Copyright October 2009, Daniel Nelson. All Rights Reserved.

This is free software. Please see the LICENSE and COPYING files for details.

### Constants

BASEDIR

  The base source directory for Prawn as installed on the system

VERSION

### Attributes

debug[RW]

Whe set to true, Prawn will verify hash options to ensure only valid keys are used. Off by default.

Example:

    >> Prawn::Document.new(:tomato => "Juicy")
    Prawn::Errors::UnknownOption:
    Detected unknown option(s): [:tomato]
    Accepted options are: [:page_size, :page_layout, :left_margin, ...]

### Public Instance Methods

PdfObject(obj, in_content_stream = false) click to toggle source

Serializes Ruby objects to their PDF equivalents. Most primitive objects will work as expected, but please note that Name objects are represented by Ruby Symbol objects and Dictionary objects are represented by Ruby hashes (keyed by symbols)

    Examples:

       PdfObject(true)      #=> "true"
       PdfObject(false)     #=> "false"
       PdfObject(1.2124)    #=> "1.2124"
       PdfObject("foo bar") #=> "(foo bar)"
       PdfObject(:Symbol)   #=> "/Symbol"
       PdfObject(["foo",:bar, [1,2]]) #=> "[foo /bar [1 2]]"

    # File lib/prawn/pdf_object.rb, line 30
    def PdfObject(obj, in_content_stream = false)
      case(obj)
      when NilClass   then "null"
      when TrueClass  then "true"
      when FalseClass then "false"
      when Numeric    then String(obj)
      when Array
        "[" << obj.map { |e| PdfObject(e, in_content_stream) }.join(' ') << "]"
      when Prawn::LiteralString
        obj = obj.gsub(/[\\\n\(\)]/) { |m| "\\#{m}" }
        "(#{obj})"
      when Time
        obj = obj.strftime("D:%Y%m%d%H%M%S%z").chop.chop + "'00'"
        obj = obj.gsub(/[\\\n\(\)]/) { |m| "\\#{m}" }
        "(#{obj})"
      when Prawn::ByteString
        "<" << obj.unpack("H*").first << ">"
      when String
        obj = "\xFE\xFF" + obj.unpack("U*").pack("n*") unless in_content_stream
        "<" << obj.unpack("H*").first << ">"
       when Symbol
         if (obj = obj.to_s) =~ /\s/
           raise Prawn::Errors::FailedObjectConversion,
             "A PDF Name cannot contain whitespace"
         else
           "/" << obj
         end
      when Hash
        output = "<< "
        obj.each do |k,v|
          unless String === k || Symbol === k
            raise Prawn::Errors::FailedObjectConversion,
              "A PDF Dictionary must be keyed by names"
          end
          output << PdfObject(k.to_sym, in_content_stream) << " " <<
                    PdfObject(v, in_content_stream) << "\n"
        end
        output << ">>"
      when Prawn::Reference
        obj.to_s
      when Prawn::NameTree::Node
        PdfObject(obj.to_hash)
      when Prawn::NameTree::Value
        PdfObject(obj.name) + " " + PdfObject(obj.value)
      when Prawn::OutlineRoot, Prawn::OutlineItem
        PdfObject(obj.to_hash)
      else
        raise Prawn::Errors::FailedObjectConversion,
          "This object cannot be serialized to PDF"
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.