I am creating a pdf file and saving it.
pdf=WickedPdf.new.pdf_from_string(
html,
header: {content: html_header},
footer: {content: html_footer},
page_height: '11in',
page_width: '8.5in',
show_as_html: true
)
save_path = Rails.root.join('example.pdf')
File.open(save_path, 'wb') do |file|
file << pdf
end
return
Is it possible to open that with chrome as an html and inspect the css ?
You should change your show_as_html: true to show_as_html: params.key?('debug')
After that, try to visit the url of pdf adding a ?debug at the end.
For example: http://localhost:3000/controller/file.pdf?debug
Now you can inspect the HTML as usual.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With