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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6e08a99588e30ca2272d553a0ba42f4e7966c4f
4
- data.tar.gz: 1050f9efcd6197eb277a681a2e568abbf2a2c684
3
+ metadata.gz: 5d462aa56ac4dadbf9ac649d28767114c7b5969c
4
+ data.tar.gz: 7f1ce2f3465d7e53365c58dd9bc9a6f34f2bbd84
5
5
  SHA512:
6
- metadata.gz: 16a952e3949c45da7dc3bb133b24d297abeb227265f661a0d39415d7a1e5a7f1b224c2bbd77f3fc85d5417fe1acb4a4b675277ac21a3625c9f66a76563946352
7
- data.tar.gz: bd725fb973840b8a9ffe76714c943aa9bf8037153238d456781f5f75b2f99df1c9a7a33ec5dc12135b7321ee4e523da035baa6264b6647ae949799b5875a39dc
6
+ metadata.gz: bbc305c676c4b4fb97d9b8b93f75728e0d158904a9426ae69beb0d2aeea7abe8afaff6b2fbd97694e490ac27d031e13130cf809446f1159f720d7936bd1195c7
7
+ data.tar.gz: 45009096f3a6f91fbec1e28514d5da9e16a5b3d31ce25a8c1877fbc06a0284156db64a79d3f027aa5974961ed775386015974d5e7d3faf958404fa9bdfb72a97
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # HtmlToPdf
2
2
 
3
- TODO: Write a gem description
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
- TODO: Write usage instructions here
21
+ write following code inside Application Controller
22
+ before_filter :html_to_pdf
22
23
 
23
- ## Contributing
24
+ in views:
24
25
 
25
- 1. Fork it ( https://github.com/[my-github-username]/htmlToPdf/fork )
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create a new Pull Request
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.
@@ -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? ? 'test' : pdf_options[:title]
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 = 'test'
33
+ @name = "#{Time.now.to_i.to_s}"
34
34
  end
35
35
  end
36
36
 
@@ -1,3 +1,3 @@
1
1
  module HtmlToPdf
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: htmlToPdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ram Laxman Yadav