module Origami::String

Module common to String objects.

Attributes

encoding[RW]

Public Instance Methods

eval_js() click to toggle source

Evaluates the current String as JavaScript.

# File lib/origami/javascript.rb, line 681
def eval_js
    self.document.eval_js(self.value)
end
to_pdfdoc() click to toggle source

Convert String object to a PDFDocEncoding encoded binary Ruby string.

# File lib/origami/string.rb, line 141
def to_pdfdoc
    detect_encoding
    self.encoding.to_pdfdoc(self.value)
end
to_utf16be() click to toggle source

Convert String object to an UTF16-BE encoded binary Ruby string.

# File lib/origami/string.rb, line 133
def to_utf16be
    detect_encoding
    self.encoding.to_utf16be(self.value)
end
to_utf8() click to toggle source

Convert String object to an UTF8 encoded Ruby string.

# File lib/origami/string.rb, line 121
def to_utf8
    detect_encoding

    utf16 = self.encoding.to_utf16be(self.value)
    utf16.slice!(0, Encoding::UTF16BE::BOM.size)

    utf16.encode("utf-8", "utf-16be")
end