pdfs2pdf 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/README.md +6 -0
- data/lib/pdfs2pdf/cli.rb +0 -7
- data/lib/pdfs2pdf/utils.rb +0 -45
- data/lib/pdfs2pdf/version.rb +1 -1
- data/pdfs2pdf.gemspec +2 -2
- metadata +6 -6
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -130,6 +130,12 @@ letters, numbers and/or underscore characters. Any other characters like
|
|
130
130
|
|
131
131
|
### Changelogs
|
132
132
|
|
133
|
+
#### 0.0.4
|
134
|
+
|
135
|
+
- Remove unused codes
|
136
|
+
- Update [agile_utils][] to 0.0.8
|
137
|
+
- Update [code_lister][] to 0.0.7
|
138
|
+
|
133
139
|
#### 0.0.3
|
134
140
|
|
135
141
|
- Update to [agile_utils][] which fix some minor bug
|
data/lib/pdfs2pdf/cli.rb
CHANGED
@@ -65,10 +65,3 @@ Combine multiple pdfs into one file with bookmarks
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
68
|
-
|
69
|
-
if __FILE__ == $PROGRAM_NAME
|
70
|
-
include Pdfs2Pdf
|
71
|
-
# TODO: make it work with File.expand_path('~/Dropbox/ebooks/')
|
72
|
-
# File.expand_path('~') # => '/home/bchoomnuan'
|
73
|
-
# File.expand_path('.') # => '/home/bchoomnuan/.../pdfs2pdf'
|
74
|
-
end
|
data/lib/pdfs2pdf/utils.rb
CHANGED
@@ -5,50 +5,6 @@ require_relative '../pdfs2pdf'
|
|
5
5
|
module Pdfs2Pdf
|
6
6
|
module Utils
|
7
7
|
class << self
|
8
|
-
# Batch convert to pdf using `wkhtmltopdf` tool
|
9
|
-
#
|
10
|
-
# @param [Array<String>] files the input file list
|
11
|
-
# @param [String] base_dir the base directory
|
12
|
-
def to_pdfs(files)
|
13
|
-
files.each_with_index do |file, index|
|
14
|
-
puts "Convert file #{index + 1} of #{files.size} : #{file}"
|
15
|
-
to_pdf(file)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
# Convert '*.xhtml' or '*.html' to pdf
|
20
|
-
#
|
21
|
-
# @param filename input filename
|
22
|
-
def to_pdf(filename)
|
23
|
-
# @todo allow the options to be passed in so that we can use different theme
|
24
|
-
# '--no-background'
|
25
|
-
fail "Invalid input file #{filename}" unless File.exist?(filename)
|
26
|
-
command = [
|
27
|
-
'wkhtmltopdf',
|
28
|
-
'--margin-top 4',
|
29
|
-
'--margin-bottom 4',
|
30
|
-
'--margin-left 4',
|
31
|
-
'--margin-right 4',
|
32
|
-
# Note: working correctly but long URL
|
33
|
-
'--header-center "[webpage] :: [page]/[topage]"',
|
34
|
-
# TODO: not yet working properly
|
35
|
-
# "--header-center #{filename.gsub(base_dir,File.basename(base_dir))} \"[page]/[topage]\"",
|
36
|
-
# "--header-center #{filename} \"[page]/[topage]\"",
|
37
|
-
'--header-spacing 1',
|
38
|
-
'--header-font-size 8',
|
39
|
-
'--header-line',
|
40
|
-
'--footer-spacing 1',
|
41
|
-
'--footer-font-size 8',
|
42
|
-
'--footer-line',
|
43
|
-
"#{filename}",
|
44
|
-
"#{filename}.pdf",
|
45
|
-
'> /dev/null']
|
46
|
-
_stdin, _stderr, status = Open3.capture3(command.join(' '))
|
47
|
-
puts "FYI: to_pdf command: #{command.join(' ')}"
|
48
|
-
# Note: may be log it and continue
|
49
|
-
fail "Problem processing #{filename}" unless status.success?
|
50
|
-
end
|
51
|
-
|
52
8
|
# Create the 'pdfmarks' file for use with 'gs' utility
|
53
9
|
#
|
54
10
|
# @param [Array<String>] pdf_files the input file list (pdf)
|
@@ -89,7 +45,6 @@ module Pdfs2Pdf
|
|
89
45
|
# @param [String] pdfmarks the pdfmarks file default to 'pdfmarks'
|
90
46
|
# @param [String] output_file the output pdf file
|
91
47
|
def merge_pdfs(list, pdfmarks = 'pdfmarks', output_file = 'output.pdf')
|
92
|
-
# puts "FYI: merge_pdfs: your list: #{list}"
|
93
48
|
_stdin, _stderr, status = Open3.capture3(
|
94
49
|
'gs',
|
95
50
|
'-q',
|
data/lib/pdfs2pdf/version.rb
CHANGED
data/pdfs2pdf.gemspec
CHANGED
@@ -17,8 +17,8 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
spec.add_runtime_dependency 'thor'
|
20
|
-
spec.add_runtime_dependency 'agile_utils', '~> 0.0.
|
21
|
-
spec.add_runtime_dependency 'code_lister', '~> 0.0.
|
20
|
+
spec.add_runtime_dependency 'agile_utils', '~> 0.0.8'
|
21
|
+
spec.add_runtime_dependency 'code_lister', '~> 0.0.7'
|
22
22
|
spec.add_runtime_dependency 'pdf-reader', '~> 1.3.3'
|
23
23
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
24
24
|
spec.add_development_dependency 'gem-ctags', '~> 1.0'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdfs2pdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-04-
|
12
|
+
date: 2014-04-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 0.0.
|
37
|
+
version: 0.0.8
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.0.
|
45
|
+
version: 0.0.8
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: code_lister
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.0.
|
53
|
+
version: 0.0.7
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.0.
|
61
|
+
version: 0.0.7
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: pdf-reader
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|