htmlToPdf 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -8
- data/lib/htmlToPdf.rb +2 -2
- data/lib/htmlToPdf/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d462aa56ac4dadbf9ac649d28767114c7b5969c
|
4
|
+
data.tar.gz: 7f1ce2f3465d7e53365c58dd9bc9a6f34f2bbd84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbc305c676c4b4fb97d9b8b93f75728e0d158904a9426ae69beb0d2aeea7abe8afaff6b2fbd97694e490ac27d031e13130cf809446f1159f720d7936bd1195c7
|
7
|
+
data.tar.gz: 45009096f3a6f91fbec1e28514d5da9e16a5b3d31ce25a8c1877fbc06a0284156db64a79d3f027aa5974961ed775386015974d5e7d3faf958404fa9bdfb72a97
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# HtmlToPdf
|
2
2
|
|
3
|
-
|
3
|
+
Description : this gem will generate pdf of the action's html requested as pdf.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,12 +18,19 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
write following code inside Application Controller
|
22
|
+
before_filter :html_to_pdf
|
22
23
|
|
23
|
-
|
24
|
+
in views:
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
<%= link_to 'download', your_action_path(:format => 'pdf') %>
|
27
|
+
|
28
|
+
customizing pdf downloads:
|
29
|
+
|
30
|
+
you can customize pdf like you can give the name and layout for the pdf.to customize pdf use this following example:
|
31
|
+
|
32
|
+
<%= link_to 'download', your_action_path(:format => 'pdf') :pdf_options => {title: 'pdf_name', layout: 'layout_name'}) -%>
|
33
|
+
|
34
|
+
# this will generate the pdf of your_action named "pdf_name.pdf" with layout "layout_name".
|
35
|
+
|
36
|
+
one can call any action as pdf and he get the pdf file of that action's html.
|
data/lib/htmlToPdf.rb
CHANGED
@@ -27,10 +27,10 @@ module HtmlToPdf
|
|
27
27
|
|
28
28
|
def initialize_downloads(pdf_options)
|
29
29
|
if pdf_options
|
30
|
-
@name = pdf_options[:title].nil? ?
|
30
|
+
@name = pdf_options[:title].nil? ? "#{Time.now.to_i.to_s}" : pdf_options[:title]
|
31
31
|
@layout = pdf_options[:layout].nil? ? 'application' : pdf_options[:layout]
|
32
32
|
else
|
33
|
-
@name =
|
33
|
+
@name = "#{Time.now.to_i.to_s}"
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
data/lib/htmlToPdf/version.rb
CHANGED