Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9c66ec3

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 2894363 + 6e58979 commit 9c66ec3

20 files changed

+48
-18
lines changed

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ require 'rake/testtask'
33

44
desc 'Run all tests'
55
task :test do
6-
require 'test/unit'
6+
require 'minitest/autorun'
77
Dir['./test/*/**/test_*.rb'].each {|test| require test }
88
end
99

docsplit.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Gem::Specification.new do |s|
22
s.name = 'docsplit'
3-
s.version = '0.7.4' # Keep version in sync with docsplit.rb
4-
s.date = '2014-02-16'
3+
s.version = '0.7.5' # Keep version in sync with docsplit.rb
4+
s.date = '2014-05-28'
55

66
s.homepage = "http://documentcloud.github.com/docsplit/"
77
s.summary = "Break Apart Documents into Images, Text, Pages and PDFs"

lib/docsplit.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# The Docsplit module delegates to the Java PDF extractors.
66
module Docsplit
77

8-
VERSION = '0.7.4' # Keep in sync with gemspec.
8+
VERSION = '0.7.5' # Keep in sync with gemspec.
99

1010
ESCAPE = lambda {|x| Shellwords.shellescape(x) }
1111

lib/docsplit/transparent_pdfs.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@ module TransparentPDFs
88
# through further extraction.
99
def ensure_pdfs(docs)
1010
[docs].flatten.map do |doc|
11-
ext = File.extname(doc)
12-
if ext.downcase == '.pdf' || File.open(doc, &:readline) =~ /\A\%PDF-\d+(\.\d+)?$/
11+
if is_pdf?(doc)
1312
doc
1413
else
1514
tempdir = File.join(Dir.tmpdir, 'docsplit')
1615
extract_pdf([doc], {:output => tempdir})
17-
File.join(tempdir, File.basename(doc, ext) + '.pdf')
16+
File.join(tempdir, File.basename(doc, File.extname(doc)) + '.pdf')
1817
end
1918
end
2019
end
2120

21+
def is_pdf?(doc)
22+
File.extname(doc).downcase == '.pdf' || File.open(doc, 'rb', &:readline) =~ /\A\%PDF-\d+(\.\d+)?/
23+
end
24+
2225
end
2326

2427
extend TransparentPDFs
51 KB
Binary file not shown.
34.1 KB
Binary file not shown.
7.61 KB
Binary file not shown.
64.6 KB
Binary file not shown.
8.15 KB
Binary file not shown.
8.15 KB
Binary file not shown.

0 commit comments

Comments
 (0)