chinapandaman / PyPDFForm

:fire: The Python library for PDF forms.
https://chinapandaman.github.io/PyPDFForm/
MIT License
391 stars 16 forks source link

Cant insert Signature to the PDF #633

Open bharathreddy1997 opened 4 months ago

bharathreddy1997 commented 4 months ago

I am trying to insert an signature image to the PDF but instead of the image, it just inserts the name of the file ,

Any help would be great

chinapandaman commented 4 months ago

I'll need more context than just that. Could you provide the template and snippet you used?

bharathreddy1997 commented 4 months ago

screen

and this is the code i am using

from PyPDFForm import PdfWrapper

filled = PdfWrapper("test.pdf").fill( { "Signature": "temp1.png" }, )

with open("output.pdf", "wb+") as output: output.write(filled.read())

chinapandaman commented 4 months ago

I also need the template. Meaning the test.pdf file in your script.

bharathreddy1997 commented 4 months ago

test.pdf

Here you go

chinapandaman commented 4 months ago

So I don't think the Signature field you are trying to fill is actually a signature field.

A signature field, for example the one in this PDF, when opened with Adobe Reader would look something like this: Screenshot 2024-05-14 130903

That's not the case for your template: Screenshot 2024-05-14 162214

In fact I'm not sure what Signature is, and when the library is unsure either, it defaults it to text field. This is why when you specify the value "temp1.png", despite it meant to be a file path, gets filled as a string by the library.