Module: RPDF

Included in:
JPEG2PDF
Defined in:
lib/rpdf/page.rb,
lib/rpdf/util.rb,
lib/rpdf/pdfname.rb,
lib/rpdf/pdfnull.rb,
lib/rpdf/trailer.rb,
lib/rpdf/version.rb,
lib/rpdf/pagetree.rb,
lib/rpdf/pdfarray.rb,
lib/rpdf/pdfobject.rb,
lib/rpdf/pdfstream.rb,
lib/rpdf/pdfstring.rb,
lib/rpdf/rectangle.rb,
lib/rpdf/pdfboolean.rb,
lib/rpdf/pdfinteger.rb,
lib/rpdf/pdfnumeric.rb,
lib/rpdf/crossreftable.rb,
lib/rpdf/pdfdictionary.rb,
lib/rpdf/documentcatalog.rb,
lib/rpdf/imagedictionary.rb

Defined Under Namespace

Classes: CrossRefTable, DocumentCatalog, ImageDictionary, PDFArray, PDFBoolean, PDFDictionary, PDFInteger, PDFName, PDFNull, PDFNumeric, PDFObject, PDFStream, PDFString, PDFVersion, Page, PageTree, Rectangle, Trailer

Constant Summary collapse

EOL =
"\r\n"
VERSION_10 =
PDFVersion.new("1.0")
VERSION_11 =
PDFVersion.new("1.1")
VERSION_12 =
PDFVersion.new("1.2")
VERSION_13 =
PDFVersion.new("1.3")
VERSION_14 =
PDFVersion.new("1.4")
VERSION_15 =
PDFVersion.new("1.5")
VERSION_DEFAULT =
VERSION_14

Class Method Summary collapse

Class Method Details

.includes_delimiter?(string) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/rpdf/util.rb', line 10

def includes_delimiter?(string)
  string =~ /[\(\)<>\[\]{}\/%]/ ? true : false
end

.includes_whitespace?(string) ⇒ Boolean

PDFRef15 p26

Returns:

  • (Boolean)


6
7
8
# File 'lib/rpdf/util.rb', line 6

def includes_whitespace?(string)
  string =~ /[\0\t\r\n\f ]/ ? true : false
end

.topdfobject(object, document = nil) ⇒ Object

convert basic object to PDF Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rpdf/util.rb', line 15

def topdfobject(object, document=nil)
  if object.kind_of?(TrueClass) or object.kind_of?(FalseClass)
    PDFBoolean.new(object, document)
  elsif object.kind_of?(Integer)
    PDFInteger.new(object, document)
  elsif object.kind_of?(Numeric)
    PDFNumeric.new(object, document)
  elsif object.kind_of?(String)
    PDFString.new(object, document)
  elsif object.kind_of?(Symbol)
    PDFName.new(object.to_s, document)
  elsif object.kind_of?(Array)
    PDFArray.new(object, document)
  elsif object.kind_of?(Hash)
    PDFDictionary.new(object, document)
  elsif object.kind_of?(NilClass)
    PDFNull.new
  elsif object.kind_of?(PDFObject)
    object
  else
    raise Exception.new("Cannot convert #{object.class} to PDF object")
  end 
end