htmlToPdf 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +3 -2
- data/htmlToPdf.gemspec +1 -1
- data/lib/htmlToPdf.rb +2 -1
- data/lib/htmlToPdf/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c74212bf8262b3f8dc17f27f3b2bfdfbd2a38880
|
4
|
+
data.tar.gz: 95c9390624f0b2965a817c077074ff7e1f21c664
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6390d8b4c3b15b81515f0c368170bbf17b81a14bdcc465ae8d6b93710fa5d43331a79e7642a7bcc44db7dd62d664d0ef0274eb12202bda65c54189fc687ca83c
|
7
|
+
data.tar.gz: 0461f89d1e5d994ba2006cea682fffa4f2f2e47705be10db51cf8178db3eba747b9968b7cf22e9f5013c175c5c14e9a0c7e3890f400d84d0dfa9a143461cf0a8
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -19,6 +19,7 @@ Or install it yourself as:
|
|
19
19
|
## Usage
|
20
20
|
|
21
21
|
write following code inside Application Controller
|
22
|
+
|
22
23
|
before_filter :html_to_pdf
|
23
24
|
|
24
25
|
in views:
|
@@ -29,8 +30,8 @@ customizing pdf downloads:
|
|
29
30
|
|
30
31
|
you can customize pdf like you can give the name and layout for the pdf.to customize pdf use this following example:
|
31
32
|
|
32
|
-
<%= link_to 'download', your_action_path(:format => 'pdf'
|
33
|
+
<%= link_to 'download', your_action_path(:format => 'pdf',:pdf_options => {title: 'pdf_name', layout: 'layout_name'}) -%>
|
33
34
|
|
34
35
|
# this will generate the pdf of your_action named "pdf_name.pdf" with layout "layout_name".
|
35
36
|
|
36
|
-
one can call any action as pdf and he get the pdf file of that action's html.
|
37
|
+
one can call any action as pdf and he get the pdf file of that action's html.
|
data/htmlToPdf.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Ram Laxman Yadav"]
|
10
10
|
spec.email = ["yadavramlaxman@gmail.com"]
|
11
11
|
spec.summary = %q{html to pdf converter gem}
|
12
|
-
spec.description = %q{this gem will generate pdf of given html using
|
12
|
+
spec.description = %q{this gem will generate pdf of given html using wkhtmltopdf}
|
13
13
|
spec.homepage = ""
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
data/lib/htmlToPdf.rb
CHANGED
@@ -10,8 +10,9 @@ module HtmlToPdf
|
|
10
10
|
_source_file = File.join(Rails.root, 'tmp', "#{Time.now.to_i.to_s}.html")
|
11
11
|
_destination_file = File.join(Rails.root, 'tmp', "#{@name}.pdf")
|
12
12
|
_html = render_to_string(:action => "#{action_name}", :formats => 'html', :layout => @layout )
|
13
|
+
file_content = _html.gsub(/\/assets/, "../public/assets")
|
13
14
|
File.open(_source_file, "w+") do |f|
|
14
|
-
f.write(
|
15
|
+
f.write(file_content)
|
15
16
|
end
|
16
17
|
spec = Gem::Specification.find_by_name("htmlToPdf")
|
17
18
|
gem_root = spec.gem_dir
|
data/lib/htmlToPdf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: htmlToPdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ram Laxman Yadav
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description: this gem will generate pdf of given html using
|
41
|
+
description: this gem will generate pdf of given html using wkhtmltopdf
|
42
42
|
email:
|
43
43
|
- yadavramlaxman@gmail.com
|
44
44
|
executables:
|