PyPDFForm 5.0.1__tar.gz → 5.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PKG-INFO +32 -19
- pypdfform-5.1.1/PyPDFForm/__init__.py +46 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/cli/entry.py +4 -2
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm.egg-info/PKG-INFO +32 -19
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm.egg-info/requires.txt +5 -5
- {pypdfform-5.0.1 → pypdfform-5.1.1}/README.md +20 -11
- {pypdfform-5.0.1 → pypdfform-5.1.1}/pyproject.toml +11 -7
- pypdfform-5.0.1/PyPDFForm/__init__.py +0 -50
- {pypdfform-5.0.1 → pypdfform-5.1.1}/LICENSE +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/cli/__init__.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/cli/common.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/cli/create.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/cli/inspect.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/cli/root.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/cli/schemas/__init__.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/cli/schemas/create.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/cli/schemas/update.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/cli/update.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/__init__.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/adapter.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/annotations/__init__.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/annotations/base.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/annotations/link.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/annotations/stamp.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/annotations/text.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/annotations/text_markup.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/assets/__init__.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/assets/bedrock.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/assets/blank.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/constants.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/coordinate.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/deprecation.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/egress.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/filler.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/font.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/hooks.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/image.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/middleware/__init__.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/middleware/base.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/middleware/checkbox.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/middleware/dropdown.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/middleware/image.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/middleware/radio.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/middleware/signature.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/middleware/text.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/patterns.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/raw/__init__.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/raw/circle.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/raw/ellipse.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/raw/image.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/raw/line.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/raw/rect.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/raw/text.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/template.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/types.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/utils.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/watermark.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/widgets/__init__.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/widgets/base.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/widgets/checkbox.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/widgets/dropdown.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/widgets/image.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/widgets/radio.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/widgets/signature.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/widgets/text.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm/lib/wrapper.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm.egg-info/SOURCES.txt +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm.egg-info/dependency_links.txt +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm.egg-info/entry_points.txt +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/PyPDFForm.egg-info/top_level.txt +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/setup.cfg +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/tests/test_bulk_create_fields.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/tests/test_create_widget.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/tests/test_draw_elements.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/tests/test_dropdown.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/tests/test_extract_middleware_attributes.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/tests/test_fill_max_length_text_field.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/tests/test_font_widths.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/tests/test_functional.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/tests/test_generate_appearance_streams.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/tests/test_js.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/tests/test_need_appearances.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/tests/test_paragraph.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/tests/test_signature.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/tests/test_use_full_widget_name.py +0 -0
- {pypdfform-5.0.1 → pypdfform-5.1.1}/tests/test_widget_attr_trigger.py +0 -0
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyPDFForm
|
|
3
|
-
Version: 5.
|
|
4
|
-
Summary: The Python library for PDF forms.
|
|
3
|
+
Version: 5.1.1
|
|
4
|
+
Summary: The Python library & CLI for PDF forms.
|
|
5
5
|
Author: Jinge Li
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/chinapandaman/PyPDFForm
|
|
8
8
|
Project-URL: Documentation, https://chinapandaman.github.io/PyPDFForm/
|
|
9
9
|
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Environment :: Console
|
|
10
11
|
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
11
13
|
Classifier: Programming Language :: Python :: 3
|
|
12
14
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -15,23 +17,25 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
15
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
18
|
Classifier: Programming Language :: Python :: 3.13
|
|
17
19
|
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
-
Classifier:
|
|
20
|
+
Classifier: Topic :: File Formats
|
|
19
21
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Topic :: Text Processing
|
|
23
|
+
Classifier: Topic :: Utilities
|
|
20
24
|
Requires-Python: >=3.10
|
|
21
25
|
Description-Content-Type: text/markdown
|
|
22
26
|
License-File: LICENSE
|
|
23
27
|
Requires-Dist: cryptography<49.0.0,>=48.0.0
|
|
24
28
|
Requires-Dist: fonttools<5.0.0,>=4.63.0
|
|
25
|
-
Requires-Dist: pikepdf<11.0.0,>=10.
|
|
29
|
+
Requires-Dist: pikepdf<11.0.0,>=10.7.2
|
|
26
30
|
Requires-Dist: pillow<13.0.0,>=12.2.0
|
|
27
|
-
Requires-Dist: pypdf<7.0.0,>=6.
|
|
31
|
+
Requires-Dist: pypdf<7.0.0,>=6.12.2
|
|
28
32
|
Requires-Dist: reportlab<5.0.0,>=4.5.1
|
|
29
33
|
Provides-Extra: cli
|
|
30
|
-
Requires-Dist: typer<1.0.0,>=0.
|
|
34
|
+
Requires-Dist: typer<1.0.0,>=0.26.1; extra == "cli"
|
|
31
35
|
Requires-Dist: jsonschema<5.0.0,>=4.26.0; extra == "cli"
|
|
32
36
|
Provides-Extra: dev
|
|
33
37
|
Requires-Dist: black<27.0.0,>=26.5.1; extra == "dev"
|
|
34
|
-
Requires-Dist: coverage<8.0.0,>=7.14.
|
|
38
|
+
Requires-Dist: coverage<8.0.0,>=7.14.1; extra == "dev"
|
|
35
39
|
Requires-Dist: isort<9.0.0,>=8.0.1; extra == "dev"
|
|
36
40
|
Requires-Dist: mike<3.0.0,>=2.2.0; extra == "dev"
|
|
37
41
|
Requires-Dist: mkdocs<2.0.0,>=1.6.1; extra == "dev"
|
|
@@ -41,12 +45,12 @@ Requires-Dist: pylint<5.0.0,>=4.0.5; extra == "dev"
|
|
|
41
45
|
Requires-Dist: pyright<2.0.0,>=1.1.409; extra == "dev"
|
|
42
46
|
Requires-Dist: pytest<10.0.0,>=9.0.3; extra == "dev"
|
|
43
47
|
Requires-Dist: requests<3.0.0,>=2.34.2; extra == "dev"
|
|
44
|
-
Requires-Dist: ruff<1.0.0,>=0.15.
|
|
48
|
+
Requires-Dist: ruff<1.0.0,>=0.15.14; extra == "dev"
|
|
45
49
|
Dynamic: license-file
|
|
46
50
|
|
|
47
51
|
<p align="center"><img src="https://github.com/chinapandaman/PyPDFForm/raw/master/docs/img/logo.png"></p>
|
|
48
52
|
<p align="center">
|
|
49
|
-
<em>PDF Form Automation Simplified
|
|
53
|
+
<em>PDF Form Automation Simplified - Create, Inspect, Style, and Fill Forms in Python or from the Command Line.</em>
|
|
50
54
|
</p>
|
|
51
55
|
<p align="center">
|
|
52
56
|
<a href="https://pypi.org/project/PyPDFForm/"><img src="https://img.shields.io/pypi/v/pypdfform?label=version&color=magenta"></a>
|
|
@@ -59,26 +63,36 @@ Dynamic: license-file
|
|
|
59
63
|
|
|
60
64
|
## Introduction
|
|
61
65
|
|
|
62
|
-
PyPDFForm is a Python library for PDF
|
|
66
|
+
PyPDFForm is a Python library and command line tool for working with PDF forms. It provides Python APIs and CLI commands for creating, inspecting, updating, and filling forms, plus common PDF utilities.
|
|
67
|
+
|
|
68
|
+
With PyPDFForm, you can:
|
|
63
69
|
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
70
|
+
* Create PDF forms, form fields, and raw elements.
|
|
71
|
+
* Inspect form fields, metadata, and values.
|
|
72
|
+
* Update field styling, behavior, and scripts.
|
|
73
|
+
* Fill PDF forms.
|
|
74
|
+
* Extract pages and merge PDFs.
|
|
67
75
|
|
|
68
|
-
|
|
76
|
+
The goal is to make PDF form work straightforward, whether you are handling one document or building a larger workflow.
|
|
69
77
|
|
|
70
78
|
## Installing
|
|
71
79
|
|
|
72
|
-
|
|
80
|
+
To use PyPDFForm as a Python library, install the base package with [pip](https://pypi.org/project/PyPDFForm/):
|
|
73
81
|
|
|
74
|
-
```shell
|
|
82
|
+
```shell
|
|
75
83
|
pip install PyPDFForm
|
|
76
84
|
```
|
|
77
85
|
|
|
86
|
+
To use the CLI, install PyPDFForm with the `cli` extra using [pipx](https://pipx.pypa.io/stable/):
|
|
87
|
+
|
|
88
|
+
```shell
|
|
89
|
+
pipx install "PyPDFForm[cli]"
|
|
90
|
+
```
|
|
91
|
+
|
|
78
92
|
## Quick Example
|
|
79
93
|

|
|
80
94
|
|
|
81
|
-
|
|
95
|
+
The GIF above shows the CLI filling a PDF form. To try the same workflow with the Python library, download the [sample PDF form](https://chinapandaman.github.io/PyPDFForm/latest/pdfs/sample_template.pdf) and run:
|
|
82
96
|
|
|
83
97
|
```python
|
|
84
98
|
from PyPDFForm import PdfWrapper
|
|
@@ -97,8 +111,7 @@ filled = PdfWrapper("sample_template.pdf", need_appearances=True).fill(
|
|
|
97
111
|
filled.write("output.pdf")
|
|
98
112
|
```
|
|
99
113
|
|
|
100
|
-
After running
|
|
101
|
-
and it should look like [this](https://chinapandaman.github.io/PyPDFForm/latest/pdfs/sample_filled.pdf).
|
|
114
|
+
After running this snippet, `output.pdf` will be written to the location you specified and should look like [this](https://chinapandaman.github.io/PyPDFForm/latest/pdfs/sample_filled.pdf).
|
|
102
115
|
|
|
103
116
|
## Documentation
|
|
104
117
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
PyPDFForm provides Python APIs and CLI commands for working with PDF forms.
|
|
4
|
+
|
|
5
|
+
It helps users create, inspect, update, and fill PDF forms, plus handle common
|
|
6
|
+
PDF utilities such as extracting pages and merging documents.
|
|
7
|
+
|
|
8
|
+
The project supports PDF form features including:
|
|
9
|
+
|
|
10
|
+
- Text, checkbox, radio, dropdown, signature, and image fields.
|
|
11
|
+
- Field styling, sizing, positioning, visibility, and editability.
|
|
12
|
+
- Form data inspection and JSON schema generation.
|
|
13
|
+
- PDF annotations, raw drawing elements, metadata, scripts, and versions.
|
|
14
|
+
|
|
15
|
+
PyPDFForm aims to make PDF form automation straightforward whether it is used
|
|
16
|
+
from Python code or from the command line.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
import logging
|
|
20
|
+
|
|
21
|
+
__version__ = "5.1.1"
|
|
22
|
+
|
|
23
|
+
from .lib.annotations import Annotations
|
|
24
|
+
from .lib.assets.blank import BlankPage
|
|
25
|
+
from .lib.middleware import Widgets
|
|
26
|
+
from .lib.raw import RawElements
|
|
27
|
+
from .lib.types import PdfArray
|
|
28
|
+
from .lib.widgets import Fields
|
|
29
|
+
from .lib.wrapper import PdfWrapper
|
|
30
|
+
|
|
31
|
+
# TODO: figure out why `Annotation sizes differ:`
|
|
32
|
+
for logger in [
|
|
33
|
+
logging.getLogger(name) for name in getattr(logging.root.manager, "loggerDict")
|
|
34
|
+
]:
|
|
35
|
+
if "pypdf" in logger.name:
|
|
36
|
+
logger.setLevel(logging.ERROR)
|
|
37
|
+
|
|
38
|
+
__all__ = [
|
|
39
|
+
"PdfWrapper",
|
|
40
|
+
"PdfArray",
|
|
41
|
+
"Annotations",
|
|
42
|
+
"Fields",
|
|
43
|
+
"BlankPage",
|
|
44
|
+
"RawElements",
|
|
45
|
+
"Widgets",
|
|
46
|
+
]
|
|
@@ -11,7 +11,8 @@ import importlib
|
|
|
11
11
|
import sys
|
|
12
12
|
|
|
13
13
|
CLI_DEPENDENCIES = {"jsonschema", "typer"}
|
|
14
|
-
CLI_INSTALL_HINT =
|
|
14
|
+
CLI_INSTALL_HINT = 'pipx install "PyPDFForm[cli]"'
|
|
15
|
+
CLI_ENV_INSTALL_HINT = "pip install 'PyPDFForm[cli]'"
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
def main() -> None:
|
|
@@ -28,7 +29,8 @@ def main() -> None:
|
|
|
28
29
|
if exc.name in CLI_DEPENDENCIES:
|
|
29
30
|
print(
|
|
30
31
|
"PyPDFForm CLI dependencies are not installed. "
|
|
31
|
-
f"Install them with: {CLI_INSTALL_HINT}"
|
|
32
|
+
f"Install them with: {CLI_INSTALL_HINT}. "
|
|
33
|
+
f"Inside an existing environment, use: {CLI_ENV_INSTALL_HINT}",
|
|
32
34
|
file=sys.stderr,
|
|
33
35
|
)
|
|
34
36
|
raise SystemExit(1) from None
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyPDFForm
|
|
3
|
-
Version: 5.
|
|
4
|
-
Summary: The Python library for PDF forms.
|
|
3
|
+
Version: 5.1.1
|
|
4
|
+
Summary: The Python library & CLI for PDF forms.
|
|
5
5
|
Author: Jinge Li
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/chinapandaman/PyPDFForm
|
|
8
8
|
Project-URL: Documentation, https://chinapandaman.github.io/PyPDFForm/
|
|
9
9
|
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Environment :: Console
|
|
10
11
|
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
11
13
|
Classifier: Programming Language :: Python :: 3
|
|
12
14
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -15,23 +17,25 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
15
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
18
|
Classifier: Programming Language :: Python :: 3.13
|
|
17
19
|
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
-
Classifier:
|
|
20
|
+
Classifier: Topic :: File Formats
|
|
19
21
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Topic :: Text Processing
|
|
23
|
+
Classifier: Topic :: Utilities
|
|
20
24
|
Requires-Python: >=3.10
|
|
21
25
|
Description-Content-Type: text/markdown
|
|
22
26
|
License-File: LICENSE
|
|
23
27
|
Requires-Dist: cryptography<49.0.0,>=48.0.0
|
|
24
28
|
Requires-Dist: fonttools<5.0.0,>=4.63.0
|
|
25
|
-
Requires-Dist: pikepdf<11.0.0,>=10.
|
|
29
|
+
Requires-Dist: pikepdf<11.0.0,>=10.7.2
|
|
26
30
|
Requires-Dist: pillow<13.0.0,>=12.2.0
|
|
27
|
-
Requires-Dist: pypdf<7.0.0,>=6.
|
|
31
|
+
Requires-Dist: pypdf<7.0.0,>=6.12.2
|
|
28
32
|
Requires-Dist: reportlab<5.0.0,>=4.5.1
|
|
29
33
|
Provides-Extra: cli
|
|
30
|
-
Requires-Dist: typer<1.0.0,>=0.
|
|
34
|
+
Requires-Dist: typer<1.0.0,>=0.26.1; extra == "cli"
|
|
31
35
|
Requires-Dist: jsonschema<5.0.0,>=4.26.0; extra == "cli"
|
|
32
36
|
Provides-Extra: dev
|
|
33
37
|
Requires-Dist: black<27.0.0,>=26.5.1; extra == "dev"
|
|
34
|
-
Requires-Dist: coverage<8.0.0,>=7.14.
|
|
38
|
+
Requires-Dist: coverage<8.0.0,>=7.14.1; extra == "dev"
|
|
35
39
|
Requires-Dist: isort<9.0.0,>=8.0.1; extra == "dev"
|
|
36
40
|
Requires-Dist: mike<3.0.0,>=2.2.0; extra == "dev"
|
|
37
41
|
Requires-Dist: mkdocs<2.0.0,>=1.6.1; extra == "dev"
|
|
@@ -41,12 +45,12 @@ Requires-Dist: pylint<5.0.0,>=4.0.5; extra == "dev"
|
|
|
41
45
|
Requires-Dist: pyright<2.0.0,>=1.1.409; extra == "dev"
|
|
42
46
|
Requires-Dist: pytest<10.0.0,>=9.0.3; extra == "dev"
|
|
43
47
|
Requires-Dist: requests<3.0.0,>=2.34.2; extra == "dev"
|
|
44
|
-
Requires-Dist: ruff<1.0.0,>=0.15.
|
|
48
|
+
Requires-Dist: ruff<1.0.0,>=0.15.14; extra == "dev"
|
|
45
49
|
Dynamic: license-file
|
|
46
50
|
|
|
47
51
|
<p align="center"><img src="https://github.com/chinapandaman/PyPDFForm/raw/master/docs/img/logo.png"></p>
|
|
48
52
|
<p align="center">
|
|
49
|
-
<em>PDF Form Automation Simplified
|
|
53
|
+
<em>PDF Form Automation Simplified - Create, Inspect, Style, and Fill Forms in Python or from the Command Line.</em>
|
|
50
54
|
</p>
|
|
51
55
|
<p align="center">
|
|
52
56
|
<a href="https://pypi.org/project/PyPDFForm/"><img src="https://img.shields.io/pypi/v/pypdfform?label=version&color=magenta"></a>
|
|
@@ -59,26 +63,36 @@ Dynamic: license-file
|
|
|
59
63
|
|
|
60
64
|
## Introduction
|
|
61
65
|
|
|
62
|
-
PyPDFForm is a Python library for PDF
|
|
66
|
+
PyPDFForm is a Python library and command line tool for working with PDF forms. It provides Python APIs and CLI commands for creating, inspecting, updating, and filling forms, plus common PDF utilities.
|
|
67
|
+
|
|
68
|
+
With PyPDFForm, you can:
|
|
63
69
|
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
70
|
+
* Create PDF forms, form fields, and raw elements.
|
|
71
|
+
* Inspect form fields, metadata, and values.
|
|
72
|
+
* Update field styling, behavior, and scripts.
|
|
73
|
+
* Fill PDF forms.
|
|
74
|
+
* Extract pages and merge PDFs.
|
|
67
75
|
|
|
68
|
-
|
|
76
|
+
The goal is to make PDF form work straightforward, whether you are handling one document or building a larger workflow.
|
|
69
77
|
|
|
70
78
|
## Installing
|
|
71
79
|
|
|
72
|
-
|
|
80
|
+
To use PyPDFForm as a Python library, install the base package with [pip](https://pypi.org/project/PyPDFForm/):
|
|
73
81
|
|
|
74
|
-
```shell
|
|
82
|
+
```shell
|
|
75
83
|
pip install PyPDFForm
|
|
76
84
|
```
|
|
77
85
|
|
|
86
|
+
To use the CLI, install PyPDFForm with the `cli` extra using [pipx](https://pipx.pypa.io/stable/):
|
|
87
|
+
|
|
88
|
+
```shell
|
|
89
|
+
pipx install "PyPDFForm[cli]"
|
|
90
|
+
```
|
|
91
|
+
|
|
78
92
|
## Quick Example
|
|
79
93
|

|
|
80
94
|
|
|
81
|
-
|
|
95
|
+
The GIF above shows the CLI filling a PDF form. To try the same workflow with the Python library, download the [sample PDF form](https://chinapandaman.github.io/PyPDFForm/latest/pdfs/sample_template.pdf) and run:
|
|
82
96
|
|
|
83
97
|
```python
|
|
84
98
|
from PyPDFForm import PdfWrapper
|
|
@@ -97,8 +111,7 @@ filled = PdfWrapper("sample_template.pdf", need_appearances=True).fill(
|
|
|
97
111
|
filled.write("output.pdf")
|
|
98
112
|
```
|
|
99
113
|
|
|
100
|
-
After running
|
|
101
|
-
and it should look like [this](https://chinapandaman.github.io/PyPDFForm/latest/pdfs/sample_filled.pdf).
|
|
114
|
+
After running this snippet, `output.pdf` will be written to the location you specified and should look like [this](https://chinapandaman.github.io/PyPDFForm/latest/pdfs/sample_filled.pdf).
|
|
102
115
|
|
|
103
116
|
## Documentation
|
|
104
117
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
cryptography<49.0.0,>=48.0.0
|
|
2
2
|
fonttools<5.0.0,>=4.63.0
|
|
3
|
-
pikepdf<11.0.0,>=10.
|
|
3
|
+
pikepdf<11.0.0,>=10.7.2
|
|
4
4
|
pillow<13.0.0,>=12.2.0
|
|
5
|
-
pypdf<7.0.0,>=6.
|
|
5
|
+
pypdf<7.0.0,>=6.12.2
|
|
6
6
|
reportlab<5.0.0,>=4.5.1
|
|
7
7
|
|
|
8
8
|
[cli]
|
|
9
|
-
typer<1.0.0,>=0.
|
|
9
|
+
typer<1.0.0,>=0.26.1
|
|
10
10
|
jsonschema<5.0.0,>=4.26.0
|
|
11
11
|
|
|
12
12
|
[dev]
|
|
13
13
|
black<27.0.0,>=26.5.1
|
|
14
|
-
coverage<8.0.0,>=7.14.
|
|
14
|
+
coverage<8.0.0,>=7.14.1
|
|
15
15
|
isort<9.0.0,>=8.0.1
|
|
16
16
|
mike<3.0.0,>=2.2.0
|
|
17
17
|
mkdocs<2.0.0,>=1.6.1
|
|
@@ -21,4 +21,4 @@ pylint<5.0.0,>=4.0.5
|
|
|
21
21
|
pyright<2.0.0,>=1.1.409
|
|
22
22
|
pytest<10.0.0,>=9.0.3
|
|
23
23
|
requests<3.0.0,>=2.34.2
|
|
24
|
-
ruff<1.0.0,>=0.15.
|
|
24
|
+
ruff<1.0.0,>=0.15.14
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<p align="center"><img src="https://github.com/chinapandaman/PyPDFForm/raw/master/docs/img/logo.png"></p>
|
|
2
2
|
<p align="center">
|
|
3
|
-
<em>PDF Form Automation Simplified
|
|
3
|
+
<em>PDF Form Automation Simplified - Create, Inspect, Style, and Fill Forms in Python or from the Command Line.</em>
|
|
4
4
|
</p>
|
|
5
5
|
<p align="center">
|
|
6
6
|
<a href="https://pypi.org/project/PyPDFForm/"><img src="https://img.shields.io/pypi/v/pypdfform?label=version&color=magenta"></a>
|
|
@@ -13,26 +13,36 @@
|
|
|
13
13
|
|
|
14
14
|
## Introduction
|
|
15
15
|
|
|
16
|
-
PyPDFForm is a Python library for PDF
|
|
16
|
+
PyPDFForm is a Python library and command line tool for working with PDF forms. It provides Python APIs and CLI commands for creating, inspecting, updating, and filling forms, plus common PDF utilities.
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
* Fill a PDF form by simply creating a Python dictionary.
|
|
20
|
-
* Create form fields on a PDF.
|
|
18
|
+
With PyPDFForm, you can:
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
* Create PDF forms, form fields, and raw elements.
|
|
21
|
+
* Inspect form fields, metadata, and values.
|
|
22
|
+
* Update field styling, behavior, and scripts.
|
|
23
|
+
* Fill PDF forms.
|
|
24
|
+
* Extract pages and merge PDFs.
|
|
25
|
+
|
|
26
|
+
The goal is to make PDF form work straightforward, whether you are handling one document or building a larger workflow.
|
|
23
27
|
|
|
24
28
|
## Installing
|
|
25
29
|
|
|
26
|
-
|
|
30
|
+
To use PyPDFForm as a Python library, install the base package with [pip](https://pypi.org/project/PyPDFForm/):
|
|
27
31
|
|
|
28
|
-
```shell
|
|
32
|
+
```shell
|
|
29
33
|
pip install PyPDFForm
|
|
30
34
|
```
|
|
31
35
|
|
|
36
|
+
To use the CLI, install PyPDFForm with the `cli` extra using [pipx](https://pipx.pypa.io/stable/):
|
|
37
|
+
|
|
38
|
+
```shell
|
|
39
|
+
pipx install "PyPDFForm[cli]"
|
|
40
|
+
```
|
|
41
|
+
|
|
32
42
|
## Quick Example
|
|
33
43
|

|
|
34
44
|
|
|
35
|
-
|
|
45
|
+
The GIF above shows the CLI filling a PDF form. To try the same workflow with the Python library, download the [sample PDF form](https://chinapandaman.github.io/PyPDFForm/latest/pdfs/sample_template.pdf) and run:
|
|
36
46
|
|
|
37
47
|
```python
|
|
38
48
|
from PyPDFForm import PdfWrapper
|
|
@@ -51,8 +61,7 @@ filled = PdfWrapper("sample_template.pdf", need_appearances=True).fill(
|
|
|
51
61
|
filled.write("output.pdf")
|
|
52
62
|
```
|
|
53
63
|
|
|
54
|
-
After running
|
|
55
|
-
and it should look like [this](https://chinapandaman.github.io/PyPDFForm/latest/pdfs/sample_filled.pdf).
|
|
64
|
+
After running this snippet, `output.pdf` will be written to the location you specified and should look like [this](https://chinapandaman.github.io/PyPDFForm/latest/pdfs/sample_filled.pdf).
|
|
56
65
|
|
|
57
66
|
## Documentation
|
|
58
67
|
|
|
@@ -5,14 +5,16 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "PyPDFForm"
|
|
7
7
|
dynamic = ["version"]
|
|
8
|
-
description = "The Python library for PDF forms."
|
|
8
|
+
description = "The Python library & CLI for PDF forms."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [{ name = "Jinge Li" }]
|
|
11
11
|
license = "MIT"
|
|
12
12
|
license-files = ["LICENSE"]
|
|
13
13
|
classifiers = [
|
|
14
14
|
"Development Status :: 5 - Production/Stable",
|
|
15
|
+
"Environment :: Console",
|
|
15
16
|
"Intended Audience :: Developers",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
16
18
|
"Programming Language :: Python :: 3",
|
|
17
19
|
"Programming Language :: Python :: 3 :: Only",
|
|
18
20
|
"Programming Language :: Python :: 3.10",
|
|
@@ -20,16 +22,18 @@ classifiers = [
|
|
|
20
22
|
"Programming Language :: Python :: 3.12",
|
|
21
23
|
"Programming Language :: Python :: 3.13",
|
|
22
24
|
"Programming Language :: Python :: 3.14",
|
|
23
|
-
"
|
|
25
|
+
"Topic :: File Formats",
|
|
24
26
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
27
|
+
"Topic :: Text Processing",
|
|
28
|
+
"Topic :: Utilities",
|
|
25
29
|
]
|
|
26
30
|
requires-python = ">=3.10"
|
|
27
31
|
dependencies = [
|
|
28
32
|
"cryptography>=48.0.0,<49.0.0",
|
|
29
33
|
"fonttools>=4.63.0,<5.0.0",
|
|
30
|
-
"pikepdf>=10.
|
|
34
|
+
"pikepdf>=10.7.2,<11.0.0",
|
|
31
35
|
"pillow>=12.2.0,<13.0.0",
|
|
32
|
-
"pypdf>=6.
|
|
36
|
+
"pypdf>=6.12.2,<7.0.0",
|
|
33
37
|
"reportlab>=4.5.1,<5.0.0",
|
|
34
38
|
]
|
|
35
39
|
|
|
@@ -39,10 +43,10 @@ Documentation = "https://chinapandaman.github.io/PyPDFForm/"
|
|
|
39
43
|
|
|
40
44
|
[project.optional-dependencies]
|
|
41
45
|
# update `CLI_DEPENDENCIES` in `PyPDFForm/cli/entry.py` when changing cli dependencies
|
|
42
|
-
cli = ["typer>=0.
|
|
46
|
+
cli = ["typer>=0.26.1,<1.0.0", "jsonschema>=4.26.0,<5.0.0"]
|
|
43
47
|
dev = [
|
|
44
48
|
"black>=26.5.1,<27.0.0",
|
|
45
|
-
"coverage>=7.14.
|
|
49
|
+
"coverage>=7.14.1,<8.0.0",
|
|
46
50
|
"isort>=8.0.1,<9.0.0",
|
|
47
51
|
"mike>=2.2.0,<3.0.0",
|
|
48
52
|
"mkdocs>=1.6.1,<2.0.0",
|
|
@@ -52,7 +56,7 @@ dev = [
|
|
|
52
56
|
"pyright>=1.1.409,<2.0.0",
|
|
53
57
|
"pytest>=9.0.3,<10.0.0",
|
|
54
58
|
"requests>=2.34.2,<3.0.0",
|
|
55
|
-
"ruff>=0.15.
|
|
59
|
+
"ruff>=0.15.14,<1.0.0",
|
|
56
60
|
]
|
|
57
61
|
|
|
58
62
|
[project.scripts]
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""
|
|
3
|
-
PyPDFForm is a pure Python library designed to streamline the process of filling PDF forms programmatically.
|
|
4
|
-
|
|
5
|
-
It provides a simple and intuitive API for interacting with PDF forms, allowing users to:
|
|
6
|
-
|
|
7
|
-
- Fill text fields with custom data.
|
|
8
|
-
- Check or uncheck checkboxes.
|
|
9
|
-
- Select radio button options.
|
|
10
|
-
- Add images to image fields.
|
|
11
|
-
- Flatten the filled form to prevent further modifications.
|
|
12
|
-
|
|
13
|
-
The library supports various PDF form features, including:
|
|
14
|
-
|
|
15
|
-
- Text field alignment (left, center, right).
|
|
16
|
-
- Font customization (size, color, family).
|
|
17
|
-
- Image field resizing and positioning.
|
|
18
|
-
- Handling of complex form structures.
|
|
19
|
-
|
|
20
|
-
PyPDFForm aims to simplify PDF form manipulation, making it accessible to developers of all skill levels.
|
|
21
|
-
"""
|
|
22
|
-
|
|
23
|
-
import logging
|
|
24
|
-
|
|
25
|
-
__version__ = "5.0.1"
|
|
26
|
-
|
|
27
|
-
from .lib.annotations import Annotations
|
|
28
|
-
from .lib.assets.blank import BlankPage
|
|
29
|
-
from .lib.middleware import Widgets
|
|
30
|
-
from .lib.raw import RawElements
|
|
31
|
-
from .lib.types import PdfArray
|
|
32
|
-
from .lib.widgets import Fields
|
|
33
|
-
from .lib.wrapper import PdfWrapper
|
|
34
|
-
|
|
35
|
-
# TODO: figure out why `Annotation sizes differ:`
|
|
36
|
-
for logger in [
|
|
37
|
-
logging.getLogger(name) for name in getattr(logging.root.manager, "loggerDict")
|
|
38
|
-
]:
|
|
39
|
-
if "pypdf" in logger.name:
|
|
40
|
-
logger.setLevel(logging.ERROR)
|
|
41
|
-
|
|
42
|
-
__all__ = [
|
|
43
|
-
"PdfWrapper",
|
|
44
|
-
"PdfArray",
|
|
45
|
-
"Annotations",
|
|
46
|
-
"Fields",
|
|
47
|
-
"BlankPage",
|
|
48
|
-
"RawElements",
|
|
49
|
-
"Widgets",
|
|
50
|
-
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|