pypdftk

Python module to drive the awesome pdftk binary.
Proudly brought to you by the revolunet team and awesome contributors
Features
fill_form
Fill a PDF with given data and returns the output PDF path
pdf_path: input PDFdatas: dictionnary of fielf names / valuesout_file(default=auto) : output PDF path. will use tempfile if not providedflatten(default=True) : flatten the final PDF
concat
Merge multiple PDFs into one single file and returns the output PDF path
files: list of PDF files to concatenateout_file(default=auto) : output PDF path. will use tempfile if not provided
split
Split a single PDF in many pages and return a list of pages paths
pdf_path: input PDFout_dir(default=auto) : output PDFs dir. will use tempfile if not provided
warning if you give a out_dir parameter, ensure its empty, or the split function may destroy your files and return incorrect results.
gen_xfdf
Generate a XFDF file suited for filling PDF forms and return the generated XFDF file path
datas: dictionnary of datas
get_num_pages
Return the number of pages for a given PDF
pdf_path: input PDF file
replace_page
Replace a page in a PDF (pdf_path) by the PDF pointed by pdf_to_insert_path.
pdf_pathis the PDF that will have its page replaced.page_numberis the number of the page in pdf_path to be replaced. It is 1-based.pdf_to_insert_pathis the PDF that will be inserted at the old page.
stamp
Applies a stamp (from stamp_pdf_path) to the PDF file in pdf_path. If no output_pdf_path is provided, it returns a temporary file with the result PDF.
[compress | uncompress]
These are only useful when you want to edit PDF code in a text
editor like vim or emacs. Remove PDF page stream compression by
applying the uncompress filter. Use the compress filter to
restore compression.
pdf_path: input PDF fileout_file(default=auto) : output PDF path. will use tempfile if not providedflatten(default=True) : flatten the final PDF
dump_data_fields
Read PDF and output form field statistics.
pdf_path: input PDF file
Example
Fill a PDF model and add a cover page :
import pypdftk
datas = {
'firstname': 'Julien',
'company': 'revolunet',
'price': 42
}
generated_pdf = pypdftk.fill_form('/path/to/model.pdf', datas)
out_pdf = pypdftk.concat(['/path/to/cover.pdf', generated_pdf])
pdftk path
By default, path is /usr/bin/pdftk, but you can override it with the PDFTK_PATH environment variable
Licence
This module is released under the permissive MIT license. Your contributions are always welcome.
Metadata
Release files for pypdftk-snap-wrkarnd 0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pypdftk-snap-wrkarnd-0.4.tar.gz | 5.7 kB | Without provenance | Details for pypdftk-snap-wrkarnd-0.4.tar.gz |
Release files / pypdftk-snap-wrkarnd-0.4.tar.gz
| Download URL | pypdftk-snap-wrkarnd-0.4.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b624eb6f19f10fe91aa2b71293cef38b06e835fee494b9ffb8eb0b5e68c8254
|
|
BLAKE2b-256 checksum How to use checksums |
aec318e123879848de9796ee4da1dd0c6034803e2baeb46ea295c3aa50f863b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.5
|
Security for pypdftk-snap-wrkarnd 0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.