How to add a Signature field?
Hi there, and thanks for the great library! It's very useful :)
I had a quick question, I was looking into the forms support, but didn't manage to find how to create a Signature field.
They are usually called Signature1, Signature2, and can be either hidden (invisible), or visible. In my case, I want to create visible signature fields, with a given height.
Is that possible today with some <input name="Signature1" type="signature"></input> incantation?
Thanks for the help :)
Hi!
There’s currently no way to add signature fields in WeasyPrint, because unfortunately there’s no type="signature" input type in HTML. As we don’t want to implement features that are not specified yet, even if they look harmless (they never are!) we usually don’t provide a solution that could be obsoleted by a future specification.
Maybe it’s possible to add these fields using the finisher function, where you can access the generated document before writing the PDF. It should be possible to find the inputs in the pydyf.PDF structure and transform them into PDF signature fields, with Python skills and the PDF specification nearby (that’s chapter 12.7.5.5 of the PDF 2.0 specification).
You can also take a look at this repository that works with older versions of WeasyPrint.
If anyone wants to help on the topic:
- If you include signatures with WeasyPrint, don’t hesitate to share a link to your code here so that other can adapt and use it.
- If you want the feature to be included in WeasyPrint, please contact the WHATWG and see if there’s already something on this topic in the HTML specification, and add a link here.