htmlToPdf 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c74212bf8262b3f8dc17f27f3b2bfdfbd2a38880
4
- data.tar.gz: 95c9390624f0b2965a817c077074ff7e1f21c664
3
+ metadata.gz: 257e60dfce3b33a1a2e39661a9239dc314708db1
4
+ data.tar.gz: 53db5e380a1de45881a73b692f46c51cdb02eaa1
5
5
  SHA512:
6
- metadata.gz: 6390d8b4c3b15b81515f0c368170bbf17b81a14bdcc465ae8d6b93710fa5d43331a79e7642a7bcc44db7dd62d664d0ef0274eb12202bda65c54189fc687ca83c
7
- data.tar.gz: 0461f89d1e5d994ba2006cea682fffa4f2f2e47705be10db51cf8178db3eba747b9968b7cf22e9f5013c175c5c14e9a0c7e3890f400d84d0dfa9a143461cf0a8
6
+ metadata.gz: 6629c1945f17e156ed9b827a02a79d11a184347e971d7fb730ed2c39e654703309e1d92e59cc11f8e482abaa2bef750ad10988b35cf92ef6ca182608f68d2779
7
+ data.tar.gz: bf61757bb5050d80dead14b25c46332e35cb94fa553b5e12537a63ae5faea12cff5cc2ecd367f9fd4110c2efdd6ca58930324056fdc54e07d6723c19885f89b7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- htmlToPdf (0.0.3)
4
+ htmlToPdf (0.0.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/lib/htmlToPdf.rb CHANGED
@@ -10,7 +10,12 @@ 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
+ if File.exists?('../public/assets')
14
+ file_content = _html.gsub(/\/assets/, "../public/assets")
15
+ else
16
+ file_content = _html.gsub(/\/assets/, "../app/assets/stylesheets")
17
+ end
18
+
14
19
  File.open(_source_file, "w+") do |f|
15
20
  f.write(file_content)
16
21
  end
@@ -20,7 +25,7 @@ module HtmlToPdf
20
25
  lib_path = "#{gem_lib}/wkhtmltopdf"
21
26
 
22
27
  `#{lib_path} #{_source_file} #{_destination_file}`
23
- File.delete(_source_file) if File.exist?(_source_file)
28
+ #File.delete(_source_file) if File.exist?(_source_file)
24
29
  send_data File.open(_destination_file, "rb") { |f| f.read }, :disposition => 'attachment',:filename => "#{@name}.pdf"
25
30
  File.delete(_destination_file)
26
31
  end
@@ -37,4 +42,4 @@ module HtmlToPdf
37
42
 
38
43
  end
39
44
 
40
- ActionController::Base.send(:include, HtmlToPdf)
45
+ ActionController::Base.send(:include, HtmlToPdf)
@@ -1,3 +1,3 @@
1
1
  module HtmlToPdf
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
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.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ram Laxman Yadav