File tree 2 files changed +11
-6
lines changed
2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -259,7 +259,8 @@ class ThingsController < ApplicationController
259
259
disable_toc_links: true ,
260
260
disable_back_links: true ,
261
261
xsl_style_sheet: ' file.xsl' }, # optional XSLT stylesheet to use for styling table of contents
262
- progress: proc { |output | puts output } # proc called when console output changes
262
+ progress: proc { |output | puts output }, # proc called when console output changes
263
+ delete_temporary_files: true # explicitly delete temporary files, default false
263
264
end
264
265
end
265
266
end
@@ -294,14 +295,14 @@ pdf = WickedPdf.new.pdf_from_html_file('/your/absolute/path/here')
294
295
# create a pdf from a URL
295
296
pdf = WickedPdf .new .pdf_from_url(' https://github.com/mileszs/wicked_pdf' )
296
297
297
- # create a pdf from string using templates, layouts and content option for header or footer
298
+ # create a pdf from string using templates, layouts, and content option for header or footer
298
299
pdf = WickedPdf .new .pdf_from_string(
299
300
render_to_string(' templates/pdf' , layout: ' pdfs/layout_pdf.html' ),
300
301
footer: {
301
302
content: render_to_string(
302
- ' templates/footer' ,
303
- layout: ' pdfs/layout_pdf.html'
304
- )
303
+ ' templates/footer' ,
304
+ layout: ' pdfs/layout_pdf.html'
305
+ )
305
306
}
306
307
)
307
308
Original file line number Diff line number Diff line change @@ -43,7 +43,11 @@ def pdf_from_string(string, options = {})
43
43
string_file . write_in_chunks ( string )
44
44
pdf_from_html_file ( string_file . path , options )
45
45
ensure
46
- string_file . close if string_file
46
+ if options [ :delete_temporary_files ] && string_file
47
+ string_file . close!
48
+ elsif string_file
49
+ string_file . close
50
+ end
47
51
end
48
52
49
53
def pdf_from_url ( url , options = { } ) # rubocop:disable Metrics/CyclomaticComplexity
You can’t perform that action at this time.
0 commit comments