hamidashi 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/exe/hamidashi +3 -3
- data/hamidashi.gemspec +1 -1
- data/lib/hamidashi.rb +3 -3
- data/lib/hamidashi/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b911bc9d39ccb9d0763cf351ea38704757d9c5d6
|
4
|
+
data.tar.gz: 9df53507831095a16c00f323c1fc9d8374e3720f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fc143212b3e6b0a7e7598091817c591fea3c7a6097dcb1665dbae792ec79045639dab983da9743e78dfa9355dbb6ffcd8575f50f4f7c6671e9f13e597151af7
|
7
|
+
data.tar.gz: b85faa5e17447be04bb1e182d2e9840b6ab40e06df95dddf3f42d842d300883abb7c8f9e370a40d55cc7fdaad16da067f8fb1e809e36ccc3ec755844a8432987
|
data/README.md
CHANGED
data/exe/hamidashi
CHANGED
@@ -13,12 +13,12 @@ pdf_path = File.expand_path(ARGV[0])
|
|
13
13
|
output_dir = File.expand_path("hamidashi-#{Time.now.strftime("%Y%m%d%H%M%S")}")
|
14
14
|
|
15
15
|
Dir.mktmpdir('hamidashi') do |temp_dir|
|
16
|
-
|
16
|
+
hamidashi = Hamidashi.new
|
17
17
|
|
18
18
|
(0...PDF::Reader.new(pdf_path).page_count).each do |page|
|
19
|
-
if
|
19
|
+
if hamidashi.overflow?(pdf_path, page)
|
20
20
|
puts page
|
21
|
-
|
21
|
+
hamidashi.save_page(pdf_path, page, "#{temp_dir}/#{page}.png")
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
data/hamidashi.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Seiei Miyagi"]
|
10
10
|
spec.email = ["hanachin@gmail.com"]
|
11
11
|
|
12
|
-
spec.summary = %q{PDF
|
12
|
+
spec.summary = %q{Detect PDF text overflow.}
|
13
13
|
spec.homepage = "https://github.com/yasslab/hamidashi"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
data/lib/hamidashi.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
require "hamidashi/version"
|
2
2
|
|
3
3
|
class Hamidashi
|
4
|
-
def
|
4
|
+
def overflow?(pdf_path, page)
|
5
5
|
colornum=`convert -density 92 -geometry #{width} -crop #{crop} "#{pdf_path}[#{page}]" -format %c histogram:info: | wc -l`.to_i
|
6
6
|
colornum != expected_colornum
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
9
|
+
def save_page(pdf_path, page, path)
|
10
10
|
`convert -density 92 -geometry #{width} "#{pdf_path}[#{page}]" #{path}`
|
11
11
|
end
|
12
12
|
|
13
13
|
private
|
14
14
|
|
15
|
-
# TODO
|
15
|
+
# TODO provide a way to set these config values
|
16
16
|
|
17
17
|
def crop
|
18
18
|
"#{crop_width}x+#{width - crop_width}+0"
|
data/lib/hamidashi/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hamidashi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seiei Miyagi
|
@@ -111,5 +111,5 @@ rubyforge_project:
|
|
111
111
|
rubygems_version: 2.4.5
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
|
-
summary: PDF
|
114
|
+
summary: Detect PDF text overflow.
|
115
115
|
test_files: []
|