OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

pdfkit does not embed images in PDF

  • Thread starter Thread starter cogitoergosum
  • Start date Start date
C

cogitoergosum

Guest
I have an HTML file that shows images correctly. However, the PDF generated from this HTML file does not show those images. What am I missing?

My Python code to generate PDF from HTML.

Code:
options = {
        'page-size' : 'A4',
        'dpi' : 400
    }
css = ['../css/report.css', '../css/w3.css']
pdfkit.from_file(htmlFilePath, pdfFilePath, options=options, css=css)

The HTML file (used to generate PDF) has reference to image files as shown here:

Code:
<h2 class="heading">Trends of parameters and set-points</h2>
<h3>Trend-1</h3>
<div>
    <img src="../png/PT-1.png"></img>
</div>
<h3>Trend-2</h3>
<div>
    <img src="../png/PT-2.png"></img>
</div>
<h3>Trend-3</h3>
<div>
    <img src="../png/PT-3.png"></img>
</div>
<p>I have an HTML file that shows images correctly. However, the PDF generated from this HTML file does not show those images. What am I missing?</p>

<p>My Python code to generate PDF from HTML.</p>

<pre><code>options = {
'page-size' : 'A4',
'dpi' : 400
}
css = ['../css/report.css', '../css/w3.css']
pdfkit.from_file(htmlFilePath, pdfFilePath, options=options, css=css)
</code></pre>

<p>The HTML file (used to generate PDF) has reference to image files as shown here:</p>

<pre><code><h2 class="heading">Trends of parameters and set-points</h2>
<h3>Trend-1</h3>
<div>
<img src="../png/PT-1.png"></img>
</div>
<h3>Trend-2</h3>
<div>
<img src="../png/PT-2.png"></img>
</div>
<h3>Trend-3</h3>
<div>
<img src="../png/PT-3.png"></img>
</div>
</code></pre>
Continue reading...
 
Top