class

PDF::Objects::Name

Inherits PDF::Objects::Base < Reference < Object

Represents a PDF name object.

Names are atomic symbols uniquely defined by a sequence of characters. They are introduced by a forward slash (/) followed by the name.

Special characters in names must be escaped using a number sign (#) followed by two hexadecimal digits representing the character code.

name = PDF::Objects::Name.new("Type")
name.to_pdf # => "/Type"

special = PDF::Objects::Name.new("Name With Spaces")
special.to_pdf # => "/Name#20With#20Spaces"

Note: The slash is part of the syntax, not the name itself.

Constants

CATALOG = new("Catalog")
CONTENTS = new("Contents")
COUNT = new("Count")
ESCAPE_CHARS = Set {0_u8, 9_u8, 10_u8, 12_u8, 13_u8, 32_u8, 40_u8, 41_u8, 60_u8, 62_u8, 91_u8, 93_u8, 123_u8, 125_u8, 47_u8, 37_u8, 35_u8}

Characters that must be escaped in PDF names (whitespace, delimiters, and # itself)

EXTGSTATE = new("ExtGState")
FILTER = new("Filter")
FLATEDECODE = new("FlateDecode")
FONT = new("Font")
ID = new("ID")
INFO = new("Info")
KIDS = new("Kids")
LENGTH = new("Length")
MEDIABOX = new("MediaBox")
PAGE = new("Page")
PAGES = new("Pages")
PARENT = new("Parent")
PROCSET = new("ProcSet")
RESOURCES = new("Resources")
ROOT = new("Root")
SIZE = new("Size")
SUBTYPE = new("Subtype")
TYPE = new("Type")

Common PDF names as constants for convenience

XOBJECT = new("XObject")

Constructors

new(value : String)
Source

Instance methods

==(other : self)

Returns true if this reference is the same as other. Invokes same?.

hash(hasher)

See Object#hash(hasher)

to_pdf

Serializes this object to PDF syntax.

Returns the PDF representation as a string.

Source
to_s

Returns a nicely readable and concise string representation of this object, typically intended for users.

This method should usually not be overridden. It delegates to #to_s(IO) which can be overridden for custom implementations.

Also see #inspect.

Source
value
Source