From dc89d81dab95dfa278707e2021bc73b96b35f4f7 Mon Sep 17 00:00:00 2001 From: chinapandaman Date: Thu, 15 Feb 2024 22:35:32 -0600 Subject: [PATCH] PPF-503: update docs --- docs/fill.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/fill.md b/docs/fill.md index 399e36a6..4cf5e432 100644 --- a/docs/fill.md +++ b/docs/fill.md @@ -68,3 +68,27 @@ filled = PdfWrapper("sample_template_with_dropdown.pdf").fill( with open("output.pdf", "wb+") as output: output.write(filled.read()) ``` + +## Fill signature widgets + +A signature field widget allows you to sign a PDF form in a handwritten format. PyPDFForm lets you use a signature image to populate +any signature field widget. + +Consider [this PDF](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/signature/sample_template_with_signature.pdf) +and [this signature image](https://github.com/chinapandaman/PyPDFForm/raw/master/image_samples/sample_signature.png): + +```python +from PyPDFForm import PdfWrapper + +signed = PdfWrapper("sample_template_with_signature.pdf").fill( + { + "signature": "sample_signature.png" + }, +) + +with open("output.pdf", "wb+") as output: + output.write(signed.read()) +``` + +**NOTE:** As described [here](install.md/#create-a-pdf-wrapper), the value of the signature in your dictionary can be a file path shown above, but also an open file object and a file stream +that's in `bytes`.