4

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 ?

Petran
  • 7,677
  • 22
  • 65
  • 104

1 Answers1

2

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.

decabeza
  • 124
  • 6