Method: Origami::PDF::Header.parse
- Defined in:
- lib/origami/header.rb
.parse(stream) ⇒ Object
:nodoc:
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/origami/header.rb', line 45 def self.parse(stream) #:nodoc: scanner = Parser.init_scanner(stream) unless scanner.scan(MAGIC).nil? maj = scanner['major'].to_i min = scanner['minor'].to_i else raise InvalidHeaderError, "Invalid header format : #{scanner.peek(15).inspect}" end scanner.skip(REGEXP_WHITESPACES) PDF::Header.new(maj, min) end |