Methods

Prawn

encoding: utf-8


encoding: utf-8

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

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


encoding: utf-8

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.


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.


encoding: utf-8

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.


encoding: utf-8

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.


dash.rb : Implements stroke dashing

Contributed by Daniel Nelson. October, 2009

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.


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.


encoding: utf-8

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.


encoding: utf-8

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.


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.


Top level Module


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.


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.


encoding: utf-8

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.


encoding: utf-8

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.


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.


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.


encoding: utf-8 measurements.rb: Conversions from other measurements to PDF points

Copyright December 2008, Florian Witteler. All Rights Reserved.


encoding: utf-8

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 31
31:   def PdfObject(obj, in_content_stream = false)
32:     case(obj)        
33:     when NilClass   then "null" 
34:     when TrueClass  then "true"
35:     when FalseClass then "false"
36:     when Numeric    then String(obj)
37:     when Array
38:       "[" << obj.map { |e| PdfObject(e, in_content_stream) }.join(' ') << "]"
39:     when Prawn::LiteralString
40:       obj = obj.gsub(/[\\\n\(\)]/) { |m| "\\#{m}" }
41:       "(#{obj})"
42:     when Time
43:       obj = obj.strftime("D:%Y%m%d%H%M%S%z").chop.chop + "'00'"
44:       obj = obj.gsub(/[\\\n\(\)]/) { |m| "\\#{m}" }
45:       "(#{obj})"
46:     when Prawn::ByteString
47:       "<" << obj.unpack("H*").first << ">"
48:     when String
49:       obj = "\xFE\xFF" + obj.unpack("U*").pack("n*") unless in_content_stream
50:       "<" << obj.unpack("H*").first << ">"
51:      when Symbol                                                         
52:        if (obj = obj.to_s) =~ /\s/
53:          raise Prawn::Errors::FailedObjectConversion, 
54:            "A PDF Name cannot contain whitespace"  
55:        else
56:          "/" << obj   
57:        end 
58:     when Hash           
59:       output = "<< "
60:       obj.each do |k,v|  
61:         unless String === k || Symbol === k
62:           raise Prawn::Errors::FailedObjectConversion, 
63:             "A PDF Dictionary must be keyed by names"
64:         end                          
65:         output << PdfObject(k.to_sym, in_content_stream) << " " << 
66:                   PdfObject(v, in_content_stream) << "\n"
67:       end  
68:       output << ">>"  
69:     when Prawn::Reference
70:       obj.to_s      
71:     when Prawn::NameTree::Node
72:       PdfObject(obj.to_hash)
73:     when Prawn::NameTree::Value
74:       PdfObject(obj.name) + " " + PdfObject(obj.value)
75:     when Prawn::OutlineRoot, Prawn::OutlineItem
76:       PdfObject(obj.to_hash)
77:     else
78:       raise Prawn::Errors::FailedObjectConversion, 
79:         "This object cannot be serialized to PDF"
80:     end     
81:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.