Django endesive PDF digital signing utility.
Project description
Django endesive PDF digital signing utility. This package allows you to digitally sign a PDF document from your Django application. It is based on https://github.com/m32/endesive
In order to digitally sign your pdf documents you will need a valid p12 / pfx certificate. You can use a self-signed certificate for testing purposes but you should aquire a certificate from a Certificate Authority for production.
Special PDF certificates issued by partners on the AATL (Adobe Approved Trust List).
Documentation
The full documentation is at https://django-endesive.readthedocs.io.
Quickstart
Install Django Endesive:
pip install django-endesive
Add it to your INSTALLED_APPS:
INSTALLED_APPS = (
...
'django_endesive.apps.DjangoEndesiveConfig',
...
)
Add the following to your setup to your settings.py file:
DJANGO_ENDESIVE = {
'PDF_CERTIFICATE_PATH': 'required: /path/to/your/certificate',
'PDF_CERTIFICATE_PASSWORD': 'optional: certificate password if applicable',
'PDF_ATTRIBUTES': {
'CONTACT': 'optional: <you@example.com>',
'LOCATION': 'optional: <your location>',
'REASON': 'optional: <Reason for Document validation>'
}
}
Here is a rather contrived example of how you would sign your pdf:
from django_endesive import pdf
from endesive.pdf import fpdf
# Generate a pdf file (this could be any file already generated by your app)
doc = fpdf.FPDF()
doc.add_page()
doc.set_font('helvetica', '', 13.0)
doc.cell(w=75.0, h=22.0, align='C',
txt='Hello, world page=1.', border=0, ln=0)
doc.output('./pdf.pdf', "F")
# Open file and feed bytes to the sign function
pdf_bytes = open('./pdf.pdf', 'rb').read()
signed_pdf = pdf.sign(pdf_bytes=pdf_bytes)
# signed_pdf bytes can now be written to a bytestream in memory or saved to a file on disk
Running Tests
Does the code actually work?
source <YOURVIRTUALENV>/bin/activate (myenv) $ pip install tox (myenv) $ tox
Credits
Tools used in rendering this package:
History
0.1.0 (2018-12-04)
First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-endesive-0.1.0.tar.gz
.
File metadata
- Download URL: django-endesive-0.1.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf3bed8a7a24c0eff1c9443780b1f6e118048cf5db0e5c63464543ece06e78d1 |
|
MD5 | ecb3f822f03b229158b061c9ef9a1e46 |
|
BLAKE2b-256 | 2e13fc1df928af9f7f6f5f0093c4bc9b4843c1643f55666be069126a74ae52d3 |