Class PDF::Reader
In: lib/pdf/reader/error.rb
lib/pdf/reader/token.rb
lib/pdf/reader/object_stream.rb
lib/pdf/reader/abstract_strategy.rb
lib/pdf/reader/register_receiver.rb
lib/pdf/reader/font.rb
lib/pdf/reader/xref.rb
lib/pdf/reader/print_receiver.rb
lib/pdf/reader/buffer.rb
lib/pdf/reader/reference.rb
lib/pdf/reader/stream.rb
lib/pdf/reader/filter.rb
lib/pdf/reader/text_receiver.rb
lib/pdf/reader/cmap.rb
lib/pdf/reader/encoding.rb
lib/pdf/reader/pages_strategy.rb
lib/pdf/reader/object_hash.rb
lib/pdf/reader/lzw.rb
lib/pdf/reader/parser.rb
lib/pdf/reader/metadata_strategy.rb
lib/pdf/reader.rb
Parent: Object

The Reader class serves as an entry point for parsing a PDF file. There are three ways to kick off processing - which one you pick will be based on personal preference and the situation.

For all examples, assume the receiver variable contains an object that will respond to various callbacks. Refer to the README and PDF::Reader::Content for more information on receivers.

Parsing a file

  PDF::Reader.file("somefile.pdf", receiver)

Parsing a String

This is useful for processing a PDF that is already in memory

  PDF::Reader.string(pdf_string, receiver)

Parsing an IO object

This can be a useful alternative to the first 2 options in some situations

  pdf = PDF::Reader.new
  pdf.parse(File.new("somefile.pdf"), receiver)

Parsing parts of a file

Both PDF::Reader#file and PDF::Reader#string accept a third argument that specifies which parts of the file to process. By default, all options are enabled, so this can be useful to cut down processing time if you‘re only interested in say, metadata.

As an example, the following call will disable parsing the contents of pages in the file, but explicitly enables processing metadata.

  PDF::Reader.new("somefile.pdf", receiver, {:metadata => true, :pages => false})

Available options are currently:

  :metadata
  :pages
  :raw_text

Methods

file   object   object_file   object_string   parse   string  

Classes and Modules

Class PDF::Reader::Buffer
Class PDF::Reader::Font
Class PDF::Reader::InvalidObjectError
Class PDF::Reader::MalformedPDFError
Class PDF::Reader::ObjectHash
Class PDF::Reader::Parser
Class PDF::Reader::PrintReceiver
Class PDF::Reader::Reference
Class PDF::Reader::RegisterReceiver
Class PDF::Reader::Stream
Class PDF::Reader::TextReceiver
Class PDF::Reader::UnsupportedFeatureError
Class PDF::Reader::XRef

Public Class methods

Parse the file with the given name, sending events to the given receiver.

Parse the file with the given name, returning an unmarshalled ruby version of represents the requested pdf object

Parse the given string, returning an unmarshalled ruby version of represents the requested pdf object

Parse the given string, sending events to the given receiver.

Public Instance methods

Given an IO object that contains PDF data, return the contents of a single object

Given an IO object that contains PDF data, parse it.

[Validate]