pdf_gem 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pdf_gem/version.rb +1 -1
- data/lib/renderer.rb +24 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cef9f7203d05d0d116b4e5294f4b7e2cd8682d2926fd1fd84373eb096a9b5ea9
|
4
|
+
data.tar.gz: 00f5792d27ce1726a3c182a9426bcaf51b6aba78e3c4d8255031abd693b0c642
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a758ed6a2a8130eefd19c76a11fa56ae25789a5aff73d0ea7278644dc96041081a411f9a8f63c5cfbf6ab40ab28bd6cfb1845ccabf266a6a016778922218447
|
7
|
+
data.tar.gz: bb4033abcfb6ddb00357ec2e6e7e6104edabd2555d459be36fd785dabec197c95601f7a835c34ab646316e180dcec6f4ca0979eb90026bced6a1777aaa2f5bcb
|
data/lib/pdf_gem/version.rb
CHANGED
data/lib/renderer.rb
CHANGED
@@ -1,11 +1,27 @@
|
|
1
|
-
module PdfGem
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
module PdfGem
|
2
|
+
|
3
|
+
class PdfGemRailtie < Rails::Railtie
|
4
|
+
initializer "my_railtie.configure_rails_initialization" do
|
5
|
+
|
6
|
+
ActionController::Renderers.add :pdf do |template, options|
|
7
|
+
params = options.except(:prefixes, :template, :disposition, :url, :html, :filename, :formats)
|
8
|
+
params[:html] = render_to_string(:action => (template.present? ? template : options.template), formats: options[:formats].present? ? options[:formats] : [:pdf] )
|
9
|
+
send_data PdfGem::pdf_from_string(params), type: Mime[:pdf], disposition: (params[:disposition].present? ? params[:disposition] : 'inline'), :filename => options[:filename]
|
10
|
+
end
|
11
|
+
|
12
|
+
ActionController::Renderers.add :pdf2 do |template, options|
|
13
|
+
params = options.except(:prefixes, :template, :disposition, :url, :html, :filename, :formats)
|
14
|
+
params[:html] = render_to_string(:action => (template.present? ? template : options.template), formats: options[:formats].present? ? options[:formats] : [:pdf] )
|
15
|
+
send_data PdfGem::pdf_from_string(params), type: Mime[:pdf], disposition: (params[:disposition].present? ? params[:disposition] : 'inline'), :filename => options[:filename]
|
16
|
+
end
|
17
|
+
if Mime::Type.lookup_by_extension(:pdf).nil?
|
18
|
+
Mime::Type.register('application/pdf', :pdf)
|
19
|
+
end
|
20
|
+
end
|
6
21
|
end
|
22
|
+
|
23
|
+
|
24
|
+
|
7
25
|
|
8
|
-
|
9
|
-
Mime::Type.register('application/pdf', :pdf)
|
10
|
-
end
|
26
|
+
|
11
27
|
end
|