Class: Origami::PDF::Parser
- Inherits:
-
Origami::Parser
- Object
- Origami::Parser
- Origami::PDF::Parser
- Defined in:
- lib/origami/parsers/pdf.rb
Direct Known Subclasses
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
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Parser
constructor
A new instance of Parser.
Methods inherited from Origami::Parser
#debug, #defer_type_cast, #error, #info, init_scanner, #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.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/origami/parsers/pdf.rb', line 26 def initialize(params = {}) = { 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 rescue Errno::ENODEV, LoadError # If we can't use noecho (e.g., in a non-interactive environment) $stderr.print "Password (will be visible): " $stdin.gets.chomp end, force: false # Force PDF header detection }.update(params) super() end |