0

Good day I've wrote this code in python to convert any website into an PDF:

import pdfkit
  
# Define Path of wkhtmltopdf.exe
pathToWkhtmltopdf = r'C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe'
  
# Point pdfkit configuration to wkhtmltopdf.exe
config = pdfkit.configuration(wkhtmltopdf=pathToWkhtmltopdf)
  
# Convert HTML file to PDF File
pdfkit.from_url('http://127.0.0.1:8050/', 'test.pdf', configuration=config)

It works perfectly well on any URL I enter into the pdfkit.from_url('<url_path_name>'), but as soon as I try to render a local dash app it comes out like this:

The dash web frame that is not rendered properly:

Here is what my test dash app looks like: My dash dashboard

and that should be converted into a pdf that should look something this:

This is a test on another website to see if my code is working,

Meanwhile when I use my localhost URL it comes out like this:

Here is the issue

I'm not sure How to fix this problem. Please note that the pdf that has to be rendered needs to be static and not image based

0 Answers0