html2pdf 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/Rakefile +0 -2
- data/lib/html2pdf/cli.rb +14 -2
- data/lib/html2pdf/html2pdf.rb +2 -3
- data/lib/html2pdf/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: 522905634a26ce2a180d99732a475a059f65d467
|
4
|
+
data.tar.gz: 5f360241a7dfdea808e8b54d7bb019e1bb648ce9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0971a4bda8d572df5cf6dc6242a53beeab584e3f025ea307290114d908ccfeda9dfeb5a029f10239d271ca8608cc1618409b2bdc55528059e976c9c7c932bdec
|
7
|
+
data.tar.gz: 7b78f1851660d073aa7672a0871795b2fba53286e9002be1b69d503be156fc02968d6260429d6ae47299da525a34472e7b92456f0029e605cdccb7a5ec068753
|
data/CHANGELOG.md
CHANGED
data/Rakefile
CHANGED
data/lib/html2pdf/cli.rb
CHANGED
@@ -32,7 +32,7 @@ module Html2Pdf
|
|
32
32
|
Html2Pdf.to_pdfs(input_files)
|
33
33
|
end
|
34
34
|
|
35
|
-
generated_files =
|
35
|
+
generated_files = add_suffix(input_files, "pdf")
|
36
36
|
AgileUtils::FileUtil.tar_gzip_files(generated_files, "html2pdf-output.tar.gz")
|
37
37
|
AgileUtils::FileUtil.delete(generated_files)
|
38
38
|
|
@@ -50,7 +50,7 @@ Options:
|
|
50
50
|
-b, [--base-dir=BASE_DIR] # Base directory
|
51
51
|
# Default: . (current directory)
|
52
52
|
-r, [--recursive], [--no-recursive] # Search for files recursively
|
53
|
-
# Default:
|
53
|
+
# Default: --recursive
|
54
54
|
-v, [--version], [--no-version] # Display version information
|
55
55
|
|
56
56
|
export multiple html files to pdfs
|
@@ -58,5 +58,17 @@ export multiple html files to pdfs
|
|
58
58
|
end
|
59
59
|
|
60
60
|
default_task :usage
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
# Add suffix to each extensions
|
65
|
+
#
|
66
|
+
# @param [Array<String>] extensions list of extension
|
67
|
+
# @param [String] suffix the suffix string
|
68
|
+
#
|
69
|
+
# @return [Array<String>] new list with the suffix added to each element
|
70
|
+
def add_suffix(extensions = [], suffix)
|
71
|
+
extensions.map { |e| "#{e}.#{suffix}" }
|
72
|
+
end
|
61
73
|
end
|
62
74
|
end
|
data/lib/html2pdf/html2pdf.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require "open3"
|
2
2
|
require "fileutils"
|
3
3
|
require_relative "../html2pdf"
|
4
|
-
|
5
4
|
module Html2Pdf
|
6
5
|
class << self
|
7
6
|
# Batch convert to pdf using `wkhtmltopdf` tool
|
@@ -20,6 +19,7 @@ module Html2Pdf
|
|
20
19
|
# @param filename input filename
|
21
20
|
def to_pdf(filename)
|
22
21
|
fail "Invalid input file #{filename}" unless File.exist?(filename)
|
22
|
+
# TODO: allow custom configuration
|
23
23
|
command = [
|
24
24
|
"wkhtmltopdf",
|
25
25
|
"--margin-top 4",
|
@@ -40,8 +40,7 @@ module Html2Pdf
|
|
40
40
|
fail "Problem processing #{filename}" unless status.success?
|
41
41
|
end
|
42
42
|
|
43
|
-
# Check and
|
44
|
-
#
|
43
|
+
# Check and return if the 'wkhtmltopdf' is available
|
45
44
|
def softwares_installed?
|
46
45
|
AgileUtils::Helper.which("wkhtmltopdf")
|
47
46
|
end
|
data/lib/html2pdf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html2pdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Burin Choomnuan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|