PDFkit with wkhtmltopdf recognizes line breaks on mac but not on ubuntu
<p>I have seen similar questions, but nothing exactly like this - i beleive it to be a config issue, but i don't know where in the chain.</p>

<p>I am able to successfully generate pdfs using pdfkit and wkhtmltopdf on both my mac and my ubuntu env - ubuntu being production. </p>

<p>There are slight rendering issues with the ubuntu version that are not there on the mac.</p>

<p>The biggest/most important issue being the page breaks which I achieve with this css:</p>

<pre><code>div.page{
    page-break-after: always !important;
    page-break-inside: avoid !important;
}
</code></pre>

<p>This is my python code (flask) for generating the pdf:</p>

<pre><code>@app.route('/report/&lt;report_key&gt;.pdf')
def report_pdf(report_key):
    #replace with sso
    user_id = 1
    config = pdfkit.configuration(wkhtmltopdf='/usr/local/bin/wkhtmltopdf')
    try:
        report = _generate_report(report_key)
    except Exception as e:
        logging.error("could not get report for {}: {}".format(report_key, e))
        raise HTTPException
    else:
        template = render_template('report-pdf.html', report=report)

        pdf = pdfkit.from_string(template.encode('ascii', 'ignore').decode('ascii'), False, configuration=config)

        response = make_response(pdf)
        response.mimetype = 'application/pdf'
        response.headers["Content-Disposition"] = "attachment; filename={}_{}.pdf".format(strftime("%Y-%m-%d", gmtime()), report_key)
        return response
</code></pre>

<p>I can only assume it is a user agent issue - however - that doesn't make sense as webkit should recognize the breaks (and I am all but sure the WK in wkhtmltopdf means webkit).</p>

<p>On the ubuntu server I am using xvfb to connect pdfkit and wkhtmltopdf - using this command I see everywhere:</p>

<pre><code>echo 'xvfb-run --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf $*' &gt; /usr/bin/wkhtmltopdf.sh
</code></pre>

<p><a href="https://github.com/wkhtmltopdf/wkhtmltopdf/issues/2020">https://github.com/wkhtmltopdf/wkhtmltopdf/issues/2020</a></p>

<p>I have tried this but it fails, I can't seem to find the proper way to send the custom-header (and propagation) options via pdfkit. That said I don't know if that is even the solution.</p>

<p>Any help would be great, Thansk</p>

<p>(BTW, this is a new acct for me. i quit FB and had to start a new one on SO - my old username had a rep of 1k - bummer.)</p>