pypdf2

How to digitally sign PDF documents using Python with an etoken (pen drive)?

假装没事ソ 提交于 2019-11-30 16:04:47
How to digitally sign PDF documents using Python? I have an etoken (in pen drive). Additionally, I have created an excel file using openpyxl and converted it into PDF. Now there is a requirement that I need to add digital signature to that PDF document. Is there any way I can achieve this in python? Use python module designed for this task, it signs digitally PDF-s. Everything what You should have is p12/pfx file with certificate. Simple example in: github repository example #!/usr/bin/env python3 # *-* coding: utf-8 *-* from oscrypto import asymmetric from endesive import pdf def main(): dct

How to digitally sign PDF documents using Python with an etoken (pen drive)?

久未见 提交于 2019-11-29 23:57:39
问题 How to digitally sign PDF documents using Python? I have an etoken (in pen drive). Additionally, I have created an excel file using openpyxl and converted it into PDF. Now there is a requirement that I need to add digital signature to that PDF document. Is there any way I can achieve this in python? 回答1: Use python module designed for this task, it signs digitally PDF-s. Everything what You should have is p12/pfx file with certificate. Simple example in: github repository example #!/usr/bin

Add a bookmark to a PDF with PyPDF2

依然范特西╮ 提交于 2019-11-29 12:35:30
I'm trying to add a bookmark to a PDF using PyPDF2. I run the following with no problems. But a bookmark is never created. Any thoughts on what I'm doing wrong. The PDF is 2 pages long. from PyPDF2 import PdfFileWriter, PdfFileReader output = PdfFileWriter() # open output input = PdfFileReader(open('test.pdf', 'rb')) # open input output.addPage(input.getPage(0)) # insert page output.addBookmark('Hello, World Bookmark', 0, parent=None) # add bookmark James C. Taylor I ran your code ( adding the text below it to write out the pdf ) and found a bookmark was, in fact, created. output =

Python Django PDF Flattening of Form Fields

岁酱吖の 提交于 2019-11-28 14:25:12
I have a project where I need to fill out pre-made PDFs and the most logical solution that comes to mind to accomplish this is to make the pre-made PDFs into PDF forms so there are tags where input values are supposed to go, then I can look through the form tags in the PDF and line them up with a dictionary of values. I have accomplished this using PyPDF2 . Overall, I took an image of a web form and then opened Acrobat and created a PDF form based on the fields seen in the image, then used PyPDF2 for filling out the PDF form fields, but the caveat is that printing those filled in values seems

Add a bookmark to a PDF with PyPDF2

吃可爱长大的小学妹 提交于 2019-11-28 06:36:51
问题 I'm trying to add a bookmark to a PDF using PyPDF2. I run the following with no problems. But a bookmark is never created. Any thoughts on what I'm doing wrong. The PDF is 2 pages long. from PyPDF2 import PdfFileWriter, PdfFileReader output = PdfFileWriter() # open output input = PdfFileReader(open('test.pdf', 'rb')) # open input output.addPage(input.getPage(0)) # insert page output.addBookmark('Hello, World Bookmark', 0, parent=None) # add bookmark 回答1: I ran your code ( adding the text

Python Django PDF Flattening of Form Fields

大城市里の小女人 提交于 2019-11-27 08:38:33
问题 I have a project where I need to fill out pre-made PDFs and the most logical solution that comes to mind to accomplish this is to make the pre-made PDFs into PDF forms so there are tags where input values are supposed to go, then I can look through the form tags in the PDF and line them up with a dictionary of values. I have accomplished this using PyPDF2 . Overall, I took an image of a web form and then opened Acrobat and created a PDF form based on the fields seen in the image, then used