pdftoimage 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.bundle/config +2 -2
- data/ChangeLog.rdoc +4 -0
- data/Gemfile.lock +2 -2
- data/lib/pdftoimage.rb +3 -2
- data/lib/pdftoimage/version.rb +1 -1
- data/pdftoimage.gemspec +7 -2
- data/spec/pdftoimage_spec.rb +16 -0
- metadata +22 -45
data/.bundle/config
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
---
|
2
|
-
|
1
|
+
--- {}
|
2
|
+
|
data/ChangeLog.rdoc
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
=== 0.1.6 / 2011-07-13
|
2
|
+
* Buggy PDF generators try to encode CreationDate and ModDate as UTF-16 as opposed to ASCII. This leads to parsing errors where the code was assuming UTF-8 encoding was in use.
|
3
|
+
=== 0.1.5 / 2011-03-08
|
4
|
+
* Fixed a bug due to the fact that poppler_utils no longer leaves off the extra padded zero.
|
1
5
|
=== 0.1.4 / 2010-11-15
|
2
6
|
* Fixed a bug concerning documents with page counts that are exact powers of 10. poppler_utils prepends one less zero to the page counts when a document count is a power of 10. This is now fixed in PDFToImage.
|
3
7
|
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pdftoimage (0.1.
|
4
|
+
pdftoimage (0.1.6)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
8
8
|
specs:
|
9
9
|
autotest (4.4.4)
|
10
10
|
diff-lcs (1.1.2)
|
11
|
-
ore-core (0.1.
|
11
|
+
ore-core (0.1.5)
|
12
12
|
rake (0.8.7)
|
13
13
|
rspec (2.1.0)
|
14
14
|
rspec-core (~> 2.1.0)
|
data/lib/pdftoimage.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'tmpdir'
|
2
2
|
require 'pdftoimage/version'
|
3
3
|
require 'pdftoimage/image'
|
4
|
+
require 'iconv'
|
4
5
|
|
5
6
|
module PDFToImage
|
6
7
|
class PDFError < RuntimeError; end
|
@@ -72,7 +73,7 @@ module PDFToImage
|
|
72
73
|
private
|
73
74
|
|
74
75
|
def page_size(filename, page)
|
75
|
-
cmd = "pdfinfo -f #{page} -l #{page} #{filename}"
|
76
|
+
cmd = "pdfinfo -f #{page} -l #{page} #{filename} | grep Page"
|
76
77
|
output = exec(cmd)
|
77
78
|
|
78
79
|
matches = /^Page.*?size:.*?(\d+).*?(\d+)/.match(output)
|
@@ -90,7 +91,7 @@ module PDFToImage
|
|
90
91
|
end
|
91
92
|
|
92
93
|
def page_count(filename)
|
93
|
-
cmd = "pdfinfo #{filename}"
|
94
|
+
cmd = "pdfinfo #{filename} | grep Pages"
|
94
95
|
output = exec(cmd)
|
95
96
|
matches = /^Pages:.*?(\d+)$/.match(output)
|
96
97
|
if matches.nil?
|
data/lib/pdftoimage/version.rb
CHANGED
data/pdftoimage.gemspec
CHANGED
@@ -5,6 +5,11 @@ begin
|
|
5
5
|
# custom logic here
|
6
6
|
end
|
7
7
|
rescue NameError
|
8
|
-
|
9
|
-
|
8
|
+
begin
|
9
|
+
require 'ore/specification'
|
10
|
+
retry
|
11
|
+
rescue LoadError
|
12
|
+
STDERR.puts "The 'my-project.gemspec' file requires Ore."
|
13
|
+
STDERR.puts "Run `gem install ore-core` to install Ore."
|
14
|
+
end
|
10
15
|
end
|
data/spec/pdftoimage_spec.rb
CHANGED
@@ -6,6 +6,22 @@ describe PDFToImage do
|
|
6
6
|
PDFToImage.const_get('VERSION').should_not be_empty
|
7
7
|
end
|
8
8
|
|
9
|
+
# I will find a better solution for having this commented out. I do not
|
10
|
+
# have permission to release the document that I used for this test case.
|
11
|
+
# I will generate a sufficiently buggy version. Basically, buggy PDF software
|
12
|
+
# sometimes corrupts CreationDate and/or ModDate such as discussed here: http://www.linuxquestions.org/questions/solaris-opensolaris-20/converting-utf-16-files-to-another-encoding-such-as-utf-8-a-630588/
|
13
|
+
# I also need to come upw ith a better solution
|
14
|
+
|
15
|
+
# describe "edge cases" do
|
16
|
+
# it "should handle invalid utf-8 in headers without crashing" do
|
17
|
+
# @pages = PDFToImage.open('spec/weird_utf8.pdf')
|
18
|
+
# @pages.size.should equal 1
|
19
|
+
# @pages[0].resize('50%').save('spec/tmp1.jpg')
|
20
|
+
# File.exists?('spec/tmp1.jpg').should equal true
|
21
|
+
# File.unlink('spec/tmp1.jpg')
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
|
9
25
|
describe "3pages.pdf" do
|
10
26
|
it "should have three pages" do
|
11
27
|
@pages = PDFToImage.open('spec/3pages.pdf')
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdftoimage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 17
|
5
4
|
prerelease:
|
6
|
-
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 5
|
10
|
-
version: 0.1.5
|
5
|
+
version: 0.1.6
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Rob Flynn
|
@@ -15,39 +10,29 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-
|
13
|
+
date: 2011-07-13 00:00:00 -04:00
|
19
14
|
default_executable:
|
20
15
|
dependencies:
|
21
16
|
- !ruby/object:Gem::Dependency
|
22
|
-
name:
|
17
|
+
name: bundler
|
23
18
|
prerelease: false
|
24
19
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
20
|
none: false
|
26
21
|
requirements:
|
27
22
|
- - ~>
|
28
23
|
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
- 6
|
33
|
-
- 0
|
34
|
-
version: 0.6.0
|
24
|
+
version: 1.0.0
|
35
25
|
type: :development
|
36
26
|
version_requirements: *id001
|
37
27
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
28
|
+
name: yard
|
39
29
|
prerelease: false
|
40
30
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
31
|
none: false
|
42
32
|
requirements:
|
43
33
|
- - ~>
|
44
34
|
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
segments:
|
47
|
-
- 1
|
48
|
-
- 0
|
49
|
-
- 0
|
50
|
-
version: 1.0.0
|
35
|
+
version: 0.6.0
|
51
36
|
type: :development
|
52
37
|
version_requirements: *id002
|
53
38
|
description: A ruby gem for converting PDF documents into a series of images. This module is based off poppler_utils and ImageMagick.
|
@@ -59,29 +44,29 @@ extensions: []
|
|
59
44
|
|
60
45
|
extra_rdoc_files:
|
61
46
|
- README.rdoc
|
62
|
-
- LICENSE.txt
|
63
47
|
- ChangeLog.rdoc
|
48
|
+
- LICENSE.txt
|
64
49
|
files:
|
65
|
-
-
|
66
|
-
-
|
67
|
-
- spec/11pages.pdf
|
68
|
-
- lib/pdftoimage/version.rb
|
69
|
-
- gemspec.yml
|
70
|
-
- ChangeLog.rdoc
|
50
|
+
- .bundle/config
|
51
|
+
- .document
|
71
52
|
- .rspec
|
72
|
-
- spec/10pages.pdf
|
73
|
-
- pdftoimage.gemspec
|
74
53
|
- .yardopts
|
75
|
-
- .
|
76
|
-
- lib/pdftoimage/image.rb
|
54
|
+
- ChangeLog.rdoc
|
77
55
|
- Gemfile
|
78
|
-
-
|
56
|
+
- Gemfile.lock
|
79
57
|
- LICENSE.txt
|
80
|
-
- lib/pdftoimage.rb
|
81
58
|
- README.rdoc
|
82
|
-
-
|
59
|
+
- Rakefile
|
60
|
+
- gemspec.yml
|
61
|
+
- lib/pdftoimage.rb
|
62
|
+
- lib/pdftoimage/image.rb
|
63
|
+
- lib/pdftoimage/version.rb
|
64
|
+
- pdftoimage.gemspec
|
65
|
+
- spec/10pages.pdf
|
66
|
+
- spec/11pages.pdf
|
67
|
+
- spec/3pages.pdf
|
83
68
|
- spec/pdftoimage_spec.rb
|
84
|
-
- .
|
69
|
+
- spec/spec_helper.rb
|
85
70
|
has_rdoc: yard
|
86
71
|
homepage: https://github.com/robflynn/pdftoimage
|
87
72
|
licenses:
|
@@ -96,25 +81,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
81
|
requirements:
|
97
82
|
- - ">="
|
98
83
|
- !ruby/object:Gem::Version
|
99
|
-
hash: 3
|
100
|
-
segments:
|
101
|
-
- 0
|
102
84
|
version: "0"
|
103
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
86
|
none: false
|
105
87
|
requirements:
|
106
88
|
- - ">="
|
107
89
|
- !ruby/object:Gem::Version
|
108
|
-
hash: 23
|
109
|
-
segments:
|
110
|
-
- 1
|
111
|
-
- 3
|
112
|
-
- 6
|
113
90
|
version: 1.3.6
|
114
91
|
requirements: []
|
115
92
|
|
116
93
|
rubyforge_project: pdftoimage
|
117
|
-
rubygems_version: 1.
|
94
|
+
rubygems_version: 1.6.2
|
118
95
|
signing_key:
|
119
96
|
specification_version: 3
|
120
97
|
summary: A ruby gem for converting PDF documents into a series of images.
|