Class: Origami::PDF::Parser

Inherits:
Origami::Parser show all
Defined in:
lib/origami/parsers/pdf.rb

Direct Known Subclasses

LazyParser, LinearParser

Constant Summary

Constants inherited from Origami::Parser

Origami::Parser::VERBOSE_DEBUG, Origami::Parser::VERBOSE_INFO, Origami::Parser::VERBOSE_QUIET, Origami::Parser::VERBOSE_TRACE

Instance Attribute Summary

Attributes inherited from Origami::Parser

#options

Instance Method Summary collapse

Methods inherited from Origami::Parser

#debug, #defer_type_cast, #error, #info, #parse, #parse_object, #parse_trailer, #parse_xreftable, #pos, #pos=, #target_data, #target_filename, #target_filesize, #trace, #warn

Constructor Details

#initialize(params = {}) ⇒ Parser

Returns a new instance of Parser.


27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/origami/parsers/pdf.rb', line 27

def initialize(params = {})
    options =
    {
        decrypt: true,                # Attempt to decrypt to document if encrypted (recommended).
        password: '',                 # Default password being tried when opening a protected document.
        prompt_password: lambda do    # Callback procedure to prompt password when document is encrypted.
            require 'io/console'
            STDERR.print "Password: "
            STDIN.noecho(&:gets).chomp
        end,
        force: false                  # Force PDF header detection
    }.update(params)

    super(options)
end