Multiple stamping #111
Answered
by
nabinpakka
nabinpakka
asked this question in
Q&A
Replies: 2 comments 3 replies
-
Hi @nabinpakka, Both of those are definitely supported (and tested) features, so the problem is likely in the calling code. As such, I'm moving this to the discussion forum as it's not an actionable bug report. If we end up finding an actual, more narrowly scoped bug in pyHanko, I'll re-file it on the issue tracker then. Can you share a sample to reproduce the problem? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thank you for the reply. Here is the code snippet along with errors.
with open("docs_signed.pdf", 'rb') as docs:
w = IncrementalPdfFileWriter(docs)
fields.append_signature_field(
w, sig_field_spec=fields.SigFieldSpec(
'Signature', box=(20, 20, 200, 200)
)
)
meta = signers.PdfSignatureMetadata(field_name='Signature')
pdfSigner = signers.PdfSigner(
meta,
signer=signer,
stamp_style=stamp.TextStampStyle(
text_box_style=text.TextBoxStyle(
font_size=0
),
background=images.PdfImage("signature_test.png"),
border_width=0
)
)
with open("docs_signed.pdf", "wb") as outf:
pdfSigner.sign_pdf(w, output=outf)
Traceback (most recent call last):
File "/home/hubbleloo/PycharmProjects/pythonProject/src/PdfSigner.py",
line 100, in <module>
_writeTextBasedStamps(signer)
File "/home/hubbleloo/PycharmProjects/pythonProject/src/PdfSigner.py",
line 65, in _writeTextBasedStamps
w = IncrementalPdfFileWriter(docs)
File "/home/hubbleloo/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/pyhanko/pdf_utils/incremental_writer.py",
line 44, in __init__
prev = PdfFileReader(input_stream, strict=strict)
File "/home/hubbleloo/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/pyhanko/pdf_utils/reader.py",
line 150, in __init__
self.xrefs, self.trailer = self.read()
File "/home/hubbleloo/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/pyhanko/pdf_utils/reader.py",
line 427, in read
raise PdfReadError('Illegal PDF header')
pyhanko.pdf_utils.misc.PdfReadError: Illegal PDF header
You can reproduce error by signing the file and again try to sign the
previously signed file
On second try, it will not return an error but while opening the pdf
it seems to be turned to a plain text file which cannot be opened.
[image: image.png]
On third try, It will reproduce above error.
…On Thu, Jun 2, 2022 at 5:03 AM Matthias Valvekens ***@***.***> wrote:
Hi @nabinpakka <https://github.com/nabinpakka>,
Both of those are definitely supported (and tested) features, so the
problem is likely in the calling code. As such, I'm moving this to the
discussion forum as it's not an actionable bug report. If we end up finding
an actual, more narrowly scoped bug in pyHanko, I'll re-file it on the
issue tracker then.
Can you share a sample to reproduce the problem?
—
Reply to this email directly, view it on GitHub
<#111 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKQEMECADN2MZ5VHIO2RU43VM7VTZANCNFSM5XTCTGSQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
nabinpakka
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the bug
Cannot stamp previously stamped file again.
To Reproduce
Stamp a file using the text stamp and save the file. Try stamping the same file with new stamp in different position.
Expected behavior
Both stamps to appear at the designated position without any error.
Environment (please complete the following information):
It is the same for signing. The signing of the same file multiple times is not permitted. Is there a way around it?
Beta Was this translation helpful? Give feedback.
All reactions