Class: DragonflyPuppeteer::Generators::Pdf
- Inherits:
-
Object
- Object
- DragonflyPuppeteer::Generators::Pdf
show all
- Defined in:
- lib/dragonfly_puppeteer/generators/pdf.rb
Defined Under Namespace
Classes: UnsupportedFormat
Instance Method Summary
collapse
Instance Method Details
#call(content, source, opts = {}) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/dragonfly_puppeteer/generators/pdf.rb', line 9
def call(content, source, opts = {})
format = 'pdf'
pdf_opts = (opts)
goto_opts = (opts)
media_type = (opts)
= (opts)
delay = (opts)
file_name = (opts)
node_command = content.env.fetch(:node_command, 'node')
content.shell_generate(ext: format) do |path|
pdf_opts[:path] = path
"#{node_command} #{script} #{Shellwords.escape(source)} '#{pdf_opts.to_json}' '#{goto_opts.to_json}' #{media_type} '#{.to_json}' #{delay}"
end
content.add_meta('format' => 'pdf', 'name' => "#{file_name}.pdf")
end
|
#update_url(url_attributes, source, opts = {}) ⇒ Object
29
30
31
32
|
# File 'lib/dragonfly_puppeteer/generators/pdf.rb', line 29
def update_url(url_attributes, source, opts = {})
file_name = (opts)
url_attributes.name = "#{file_name}.pdf"
end
|