14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/tilt/pdf.rb', line 14
def evaluate(scope, locals, &block)
files = aux_files
files << main_html_file
render_to_tmp(*files, scope, locals, block) do |tmp|
opts = pdfkit_options
if
htmp = tmp.select { |_, f, _| f == }.first[2]
opts.merge!('header-html' => htmp) if
end
if
ftmp = tmp.select { |_, f, _| f == }.first[2]
opts.merge!('footer-html' => ftmp) if
end
main = tmp.select { |_, f, _| f == main_html_file }.first[2]
kit = PDFKit.new(File.read(main), opts)
@output = kit.to_pdf
end
@output
end
|