Class PDF::Reader::Parser
In: lib/pdf/reader/parser.rb
Parent: Object

An internal PDF::Reader class that reads objects from the PDF file and converts them into useable ruby objects (hash‘s, arrays, true, false, etc)

Methods

new   object   parse_token  

Constants

TOKEN_STRATEGY = proc { |parser, token| Token.new(token) }
STRATEGIES = { "/" => proc { |parser, token| parser.send(:pdf_name) }, "<<" => proc { |parser, token| parser.send(:dictionary) }, "[" => proc { |parser, token| parser.send(:array) }, "(" => proc { |parser, token| parser.send(:string) }, "<" => proc { |parser, token| parser.send(:hex_string) }, nil => proc { nil }, "true" => proc { true }, "false" => proc { false }, "null" => proc { nil }, "obj" => TOKEN_STRATEGY, "endobj" => TOKEN_STRATEGY, "stream" => TOKEN_STRATEGY, "endstream" => TOKEN_STRATEGY, ">>" => TOKEN_STRATEGY, "]" => TOKEN_STRATEGY, ">" => TOKEN_STRATEGY, ")" => TOKEN_STRATEGY

Public Class methods

Create a new parser around a PDF::Reader::Buffer object

buffer - a PDF::Reader::Buffer object that contains PDF data objects - a PDF::Reader::ObjectHash object that can return objects from the PDF file

Public Instance methods

Reads an entire PDF object from the buffer and returns it as a Ruby String. If the object is a content stream, returns both the stream and the dictionary that describes it

id - the object ID to return gen - the object revision number to return

Reads the next token from the underlying buffer and convets it to an appropriate object

operators - a hash of supported operators to read from the underlying buffer.

[Validate]