I am using PDFKit to render a partial view as a PDF file. However, I'm running into some issues when trying to use render_to_string (preferred method), rather than an external web request.
The pdf file when rendered using a url:
html = "#{root_url}/contracts/#{@contract.id}"
pdf = PDFKit.new(html, page_size: 'Letter').to_pdf
The pdf file when rendered using render_to_string:
html = render_to_string :partial => "agreement"
pdf = PDFKit.new(html , page_size: 'Letter').to_pdf
*from the console*
html => "\n\n<style>\n #contract h2{text-align: center; margin-bottom: 10px;}\n #contract em{font-weight: bold; text-decoration: underline; font-style: normal;}\n #contract p.tab{margin-left: 25px;}\n #contract ol{list-style:lower-alpha;}\n #contract ol li{margin-left: 25px; font-size: 1em; line-height: 1.615em; color: #555; margin-bottom: 5px;}\n #contract b{font-weight: bold;}\n #contract p p{margin-left: 10px;}\n</style>\n<div id=\"contract\">\n <p>This agreement (“<b>Agreement</b>”) is entered into...
What am I doing wrong?