Unable to locate wkhtmltopdf path in Streamlit app on Streamlit.io

I have a Streamlit app that utilizes wkhtmltopdf for PDF generation. I’ve included wkhtmltopdf in my packages.txt file for deployment on Streamlit.io. The app runs without errors locally, but when deployed on Streamlit.io, I encounter issues with locating the wkhtmltopdf binary.

The following code returns an error.

import pdfkit
import streamlit as st
wkhtmltopdf_path="/usr/bin/wkhtmltopdf"
config = pdfkit.configuration(wkhtmltopdf=wkhtmltopdf_path)
st.write(config)

So I think that even if “wkhtmltopdf” is in the packages.txt file, it is not actually installed.

If it is installed, how can I determine the correct wkhtmltopdf path on Streamlit.io? Do I need to set the wkhtmltopdf_path explicitly in the Streamlit app code, and if so, how can I find the correct path on Streamlit.io? Are there any specific considerations for using wkhtmltopdf on Streamlit.io that I might be missing?

Any guidance or insights on resolving this issue would be greatly appreciated. Thank you!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.