-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PDF to Image conversion skips signature image created with Adobe Reader #191
Comments
Maybe the image is part of an AcroForm or something? Try calling |
Here's the corrected text with minor edits and fixed typos: We tried the following code: pdf = pdfium.PdfDocument(source)
pdf.init_form()
page = pdf.get_page(0)
pdf_bitmap = page.render(
scale=3,
rotation=0,
crop=(0,0,0,0),
grayscale=False,
optimize_mode=None,
draw_annots=True
)
pdf_bitmap.to_pil().save(target) However, it did not work and it's possible that the PDF is an AcroForm. How can I check this? Unfortunately, I cannot share the document as it's confidential. PDF2IMG works but it's too slow. I am not sure if this will help identify why the signature is not appearing |
If the above does not work, then it's probably not about forms, but you could run If you can't share a PDF that demonstrates the problem, then I'm afraid we can't help you. Apart from that, what's PDF2Miner? Is this another PDF rendering engine? Could you share a link? |
Hi, sorry the library is PDF2IMG was a typo, the function returns None. |
Hmm, could you maybe provide/craft a non-confidential PDF that shows the problem (or whoever has such a document or is capable of creating one) ? |
I apologize, but I was unable to create the PDF file as it was created in an office and I am not familiar with the process. However, I found that another library which also uses pdfium had faced a similar issue during implementation. You may find this information useful, and I recommend taking a look at this link: pvginkel/PdfiumViewer#87. |
Thanks, the linked test file (archive url) shows the problem. I'll investigate. |
I found and fixed an issue with the multi-page renderer not initializing the formenv in worker processes. The signature of the file mentioned in #191 (comment) (which is part of an AcroForm) now displays correctly with the multi-page renderer (as used by the |
So even if it seems to work for this particular document, it might be a feature not fully supported by PDFium. |
This reverts commit 4d25bb2. I'm not too sure about this change. Generally having a callback just for the form config seems slightly uncomfortable. I think we should keep the plain config for init_forms() and add an optional callback to PdfDocument.render() only.
Thank you, mara004. You work very quickly. Unfortunately, I was unable to check the information you provided due to the high security environment in which the PDFs are stored. Therefore, I suggest we close this issue for now. If I am able to access the information in the future, I will be sure to share it with you. |
Thanks, feel free to reopen if you get access to the PDF again. |
Hello,
I'm trying to convert a PDF document into an image using the render method in version 4.2.0 of the library. However, the signature image created with Adobe Reader is not being rendered in the resulting image.
Here's the code snippet I'm using:
Is there a way to include the signature image in the resulting image? Any help or suggestion would be greatly appreciated. Thank you.
The text was updated successfully, but these errors were encountered: