PDF::Objects::Str
Inherits PDF::Objects::Base < Reference < Object
Represents a PDF string object.
PDF strings can be written in two forms:
- Literal strings: enclosed in parentheses
(Hello) - Hexadecimal strings: enclosed in angle brackets
<48656C6C6F>
Literal strings can contain:
- Balanced parentheses without escaping
- Escape sequences:
\n,\r,\t,\b,\f,\\,\(,\) - Octal character codes:
\ddd
For Unicode text, PDF uses UTF-16BE with a BOM (byte order mark).
str = PDF::Objects::Str.new("Hello, World!")
str.to_pdf # => "(Hello, World!)"
hex = PDF::Objects::Str.new("Hello", hex: true)
hex.to_pdf # => "<48656C6C6F>"
Constants
BOM = "\xFE\xFF"
UTF-16BE Byte Order Mark
Constructors
Instance methods
==(other : self)
Returns true if this reference is the same as other. Invokes same?.
hash(hasher)
See Object#hash(hasher)
hex?
Sourcevalue
Source