Can pyHanko digitally sign HTML content directly, or is PDF conversion required?

I’m working on a Django web application where documents are generated and displayed using styled HTML templates (e.g., for formal printable forms). These are rendered in the browser with proper formatting and layout.

I am using pyHanko (version 0.29.0) to apply digital signatures via .p12 certificates, and it works great when signing pre-generated PDF files.

However, in my case:

The documents are originally in HTML format and rendered in the browser.

I want to apply a digital signature directly to the document without converting to PDF first, if possible.

Right now, I convert the HTML to PDF using tools like wkhtmltopdf or pdfkit, then pass the PDF to pyHanko for signing.

This adds some complexity and dependency issues (e.g., rendering differences or install problems with wkhtmltopdf).

Is there any way to digitally sign HTML-rendered documents directly using pyHanko, or is conversion to PDF strictly necessary?

If PDF is required, are there any modern or reliable ways to convert HTML to PDF (ideally Python-based) that work smoothly with pyHanko?

Вернуться на верх