pdf-reader 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/CHANGELOG +3 -0
  2. data/Rakefile +1 -1
  3. data/lib/pdf/hash.rb +11 -1
  4. metadata +2 -2
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v0.8.1 (27th November 2009)
2
+ - Added PDF::Hash#version. Provides access to the source file PDF version
3
+
1
4
  v0.8.0 (20th November 2009)
2
5
  - Added PDF::Hash. It provides direct access to objects from a PDF file
3
6
  with an API that emulates the standard Ruby hash
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'rake/testtask'
6
6
  require "rake/gempackagetask"
7
7
  require 'spec/rake/spectask'
8
8
 
9
- PKG_VERSION = "0.8.0"
9
+ PKG_VERSION = "0.8.1"
10
10
  PKG_NAME = "pdf-reader"
11
11
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
12
12
 
@@ -27,7 +27,7 @@ module PDF
27
27
  include Enumerable
28
28
 
29
29
  attr_accessor :default
30
- attr_reader :trailer
30
+ attr_reader :trailer, :version
31
31
 
32
32
  # Creates a new PDF:Hash object. input can be a string with a valid filename,
33
33
  # a string containing a PDF file, or an IO object.
@@ -45,6 +45,7 @@ module PDF
45
45
  else
46
46
  raise ArgumentError, "input must be an IO-like object or a filename"
47
47
  end
48
+ @version = read_version(io)
48
49
  buffer = PDF::Reader::Buffer.new(io)
49
50
  @xref = PDF::Reader::XRef.new(buffer)
50
51
  @trailer = @xref.load
@@ -198,5 +199,14 @@ module PDF
198
199
  ret
199
200
  end
200
201
 
202
+ private
203
+
204
+ def read_version(io)
205
+ io.seek(0)
206
+ m, version = *io.read(10).match(/PDF-(\d.\d)/)
207
+ io.seek(0)
208
+ version
209
+ end
210
+
201
211
  end
202
212
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdf-reader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Jones
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-20 00:00:00 +11:00
12
+ date: 2009-11-27 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency