pdf-reader 0.11.0.alpha → 0.12.0.alpha
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +17 -1
- data/README.rdoc +31 -1
- data/bin/pdf_list_callbacks +2 -0
- data/examples/callbacks.rb +2 -1
- data/examples/extract_bates.rb +3 -2
- data/examples/extract_images.rb +146 -23
- data/examples/hash.rb +5 -5
- data/examples/metadata.rb +5 -16
- data/examples/page_count.rb +13 -0
- data/examples/rspec.rb +17 -41
- data/examples/text.rb +4 -29
- data/examples/version.rb +3 -15
- data/lib/pdf/reader.rb +45 -27
- data/lib/pdf/reader/encoding.rb +3 -3
- data/lib/pdf/reader/error.rb +1 -0
- data/lib/pdf/reader/filter.rb +64 -9
- data/lib/pdf/reader/font.rb +0 -17
- data/lib/pdf/reader/form_xobject.rb +83 -0
- data/lib/pdf/reader/glyph_hash.rb +88 -0
- data/lib/pdf/reader/glyphlist.txt +1 -1
- data/lib/pdf/reader/object_hash.rb +42 -12
- data/lib/pdf/reader/page.rb +63 -17
- data/lib/pdf/reader/page_text_receiver.rb +38 -4
- data/lib/pdf/reader/standard_security_handler.rb +186 -0
- data/lib/pdf/reader/stream.rb +2 -2
- metadata +39 -9
- data/examples/page_counter_improved.rb +0 -23
- data/examples/page_counter_naive.rb +0 -24
data/lib/pdf/reader/stream.rb
CHANGED
@@ -30,8 +30,8 @@ class PDF::Reader
|
|
30
30
|
# compression, etc) and a stream of bytes.
|
31
31
|
#
|
32
32
|
class Stream
|
33
|
-
attr_accessor :hash
|
34
|
-
|
33
|
+
attr_accessor :hash, :data
|
34
|
+
|
35
35
|
################################################################################
|
36
36
|
# Creates a new stream with the specified dictionary and data. The dictionary
|
37
37
|
# should be a standard ruby hash, the data should be a standard ruby string.
|
metadata
CHANGED
@@ -4,10 +4,10 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: true
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 12
|
8
8
|
- 0
|
9
9
|
- alpha
|
10
|
-
version: 0.
|
10
|
+
version: 0.12.0.alpha
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- James Healy
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-08-28 00:00:00 +10:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -54,14 +54,29 @@ dependencies:
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
segments:
|
56
56
|
- 2
|
57
|
-
-
|
58
|
-
version: "2.
|
57
|
+
- 3
|
58
|
+
version: "2.3"
|
59
59
|
type: :development
|
60
60
|
version_requirements: *id003
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
62
|
+
name: ZenTest
|
63
63
|
prerelease: false
|
64
64
|
requirement: &id004 !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
segments:
|
70
|
+
- 4
|
71
|
+
- 4
|
72
|
+
- 2
|
73
|
+
version: 4.4.2
|
74
|
+
type: :development
|
75
|
+
version_requirements: *id004
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: Ascii85
|
78
|
+
prerelease: false
|
79
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
65
80
|
none: false
|
66
81
|
requirements:
|
67
82
|
- - ~>
|
@@ -72,7 +87,20 @@ dependencies:
|
|
72
87
|
- 0
|
73
88
|
version: 1.0.0
|
74
89
|
type: :runtime
|
75
|
-
version_requirements: *
|
90
|
+
version_requirements: *id005
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: ruby-rc4
|
93
|
+
prerelease: false
|
94
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
segments:
|
100
|
+
- 0
|
101
|
+
version: "0"
|
102
|
+
type: :runtime
|
103
|
+
version_requirements: *id006
|
76
104
|
description: The PDF::Reader library implements a PDF parser conforming as much as possible to the PDF specification from Adobe
|
77
105
|
email:
|
78
106
|
- jimmy@deefa.com
|
@@ -88,7 +116,6 @@ extra_rdoc_files:
|
|
88
116
|
- CHANGELOG
|
89
117
|
- MIT-LICENSE
|
90
118
|
files:
|
91
|
-
- examples/page_counter_naive.rb
|
92
119
|
- examples/rspec.rb
|
93
120
|
- examples/metadata.rb
|
94
121
|
- examples/extract_bates.rb
|
@@ -96,17 +123,20 @@ files:
|
|
96
123
|
- examples/callbacks.rb
|
97
124
|
- examples/text.rb
|
98
125
|
- examples/version.rb
|
99
|
-
- examples/
|
126
|
+
- examples/page_count.rb
|
100
127
|
- examples/extract_images.rb
|
101
128
|
- lib/pdf/reader/glyphlist.txt
|
102
129
|
- lib/pdf/reader/error.rb
|
130
|
+
- lib/pdf/reader/glyph_hash.rb
|
103
131
|
- lib/pdf/reader/font.rb
|
104
132
|
- lib/pdf/reader/lzw.rb
|
105
133
|
- lib/pdf/reader/print_receiver.rb
|
106
134
|
- lib/pdf/reader/reference.rb
|
107
135
|
- lib/pdf/reader/filter.rb
|
108
136
|
- lib/pdf/reader/text_receiver.rb
|
137
|
+
- lib/pdf/reader/standard_security_handler.rb
|
109
138
|
- lib/pdf/reader/pages_strategy.rb
|
139
|
+
- lib/pdf/reader/form_xobject.rb
|
110
140
|
- lib/pdf/reader/abstract_strategy.rb
|
111
141
|
- lib/pdf/reader/page_text_receiver.rb
|
112
142
|
- lib/pdf/reader/encoding.rb
|
@@ -1,23 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# coding: utf-8
|
3
|
-
|
4
|
-
# Improved Page Counter
|
5
|
-
#
|
6
|
-
# A simple app to display the number of pages in a PDF File.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'rubygems'
|
10
|
-
require 'pdf/reader'
|
11
|
-
|
12
|
-
class PageReceiver
|
13
|
-
attr_accessor :pages
|
14
|
-
|
15
|
-
# Called when page parsing ends
|
16
|
-
def page_count(arg)
|
17
|
-
@pages = arg
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
receiver = PageReceiver.new
|
22
|
-
pdf = PDF::Reader.file("somefile.pdf", receiver, :pages => false)
|
23
|
-
puts "#{receiver.pages} pages"
|
@@ -1,24 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# coding: utf-8
|
3
|
-
|
4
|
-
# A simple app to count the number of pages in a PDF File.
|
5
|
-
|
6
|
-
require 'rubygems'
|
7
|
-
require 'pdf/reader'
|
8
|
-
|
9
|
-
class PageReceiver
|
10
|
-
attr_accessor :counter
|
11
|
-
|
12
|
-
def initialize
|
13
|
-
@counter = 0
|
14
|
-
end
|
15
|
-
|
16
|
-
# Called when page parsing ends
|
17
|
-
def end_page
|
18
|
-
@counter += 1
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
receiver = PageReceiver.new
|
23
|
-
pdf = PDF::Reader.file("somefile.pdf", receiver)
|
24
|
-
puts "#{receiver.counter} pages"
|