%global _empty_manifest_terminate_build 0
Name: python-PyPDFForm
Version: 1.2.8
Release: 1
Summary: The Python library for PDF forms.
License: MIT License
URL: https://github.com/chinapandaman/PyPDFForm
Source0: https://mirrors.nju.edu.cn/pypi/web/packages/8a/83/a40a40c423f1dbf6dac7af6e6f2e3c8b6778a4e289a7a8f7a35c009b42be/PyPDFForm-1.2.8.tar.gz
BuildArch: noarch
Requires: python3-pdfrw
Requires: python3-pillow
Requires: python3-reportlab
%description
![](https://github.com/chinapandaman/PyPDFForm/raw/master/logo.png)
## Introduction
PyPDFForm is a pure Python library for PDF form processing.
It allows filling a PDF form programmatically by creating
a Python dictionary with keys matching its annotated names
for elements like text fields and checkboxes. It also supports other functionalities such as
drawing image and merging multiple PDFs together.
## Installing
Install using [pip](https://pip.pypa.io/en/stable/):
```shell script
pip install PyPDFForm
```
## Quick Example
![Check out the GitHub repository for a live demo if you can't see it here.](https://github.com/chinapandaman/PyPDFForm/raw/master/demo.gif)
A sample PDF form can be found [here](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/sample_template.pdf). Download it and try:
```python
import os
from PyPDFForm import PyPDFForm
PATH_TO_DOWNLOADED_SAMPLE_PDF_FORM = os.path.join(
os.path.expanduser("~/Downloads"), "sample_template.pdf"
) # Change this to where you downloaded the sample PDF form
PATH_TO_FILLED_PDF_FORM = os.path.join(
os.path.expanduser("~"), "output.pdf"
) # Change this to where you wish to put your filled PDF form
with open(PATH_TO_FILLED_PDF_FORM, "wb+") as output:
output.write(
PyPDFForm(PATH_TO_DOWNLOADED_SAMPLE_PDF_FORM)
.fill(
{
"test": "test_1",
"check": True,
"test_2": "test_2",
"check_2": False,
"test_3": "test_3",
"check_3": True,
},
)
.read()
)
```
After running the above code snippet you can find `output.pdf` at the location you specified,
and it should look like [this](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/sample_filled.pdf).
## Documentation
[Examples](https://github.com/chinapandaman/PyPDFForm/blob/master/docs/examples.md)
## How to Contribute
If you wish to improve this library, there is one specific way you can contribute
on top of the usual open source project norms such as issues and pull requests.
It is difficult to make sure that the library supports all the PDF form creating tools out
there. So if you run into a case where the library does not work for certain PDF forms created by
certain tools, feel free to open an issue with the problematic PDF form attached. I will seek
to make the library support the attached PDF form as well as the tool used to create it.
%package -n python3-PyPDFForm
Summary: The Python library for PDF forms.
Provides: python-PyPDFForm
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-PyPDFForm
![](https://github.com/chinapandaman/PyPDFForm/raw/master/logo.png)
## Introduction
PyPDFForm is a pure Python library for PDF form processing.
It allows filling a PDF form programmatically by creating
a Python dictionary with keys matching its annotated names
for elements like text fields and checkboxes. It also supports other functionalities such as
drawing image and merging multiple PDFs together.
## Installing
Install using [pip](https://pip.pypa.io/en/stable/):
```shell script
pip install PyPDFForm
```
## Quick Example
![Check out the GitHub repository for a live demo if you can't see it here.](https://github.com/chinapandaman/PyPDFForm/raw/master/demo.gif)
A sample PDF form can be found [here](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/sample_template.pdf). Download it and try:
```python
import os
from PyPDFForm import PyPDFForm
PATH_TO_DOWNLOADED_SAMPLE_PDF_FORM = os.path.join(
os.path.expanduser("~/Downloads"), "sample_template.pdf"
) # Change this to where you downloaded the sample PDF form
PATH_TO_FILLED_PDF_FORM = os.path.join(
os.path.expanduser("~"), "output.pdf"
) # Change this to where you wish to put your filled PDF form
with open(PATH_TO_FILLED_PDF_FORM, "wb+") as output:
output.write(
PyPDFForm(PATH_TO_DOWNLOADED_SAMPLE_PDF_FORM)
.fill(
{
"test": "test_1",
"check": True,
"test_2": "test_2",
"check_2": False,
"test_3": "test_3",
"check_3": True,
},
)
.read()
)
```
After running the above code snippet you can find `output.pdf` at the location you specified,
and it should look like [this](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/sample_filled.pdf).
## Documentation
[Examples](https://github.com/chinapandaman/PyPDFForm/blob/master/docs/examples.md)
## How to Contribute
If you wish to improve this library, there is one specific way you can contribute
on top of the usual open source project norms such as issues and pull requests.
It is difficult to make sure that the library supports all the PDF form creating tools out
there. So if you run into a case where the library does not work for certain PDF forms created by
certain tools, feel free to open an issue with the problematic PDF form attached. I will seek
to make the library support the attached PDF form as well as the tool used to create it.
%package help
Summary: Development documents and examples for PyPDFForm
Provides: python3-PyPDFForm-doc
%description help
![](https://github.com/chinapandaman/PyPDFForm/raw/master/logo.png)
## Introduction
PyPDFForm is a pure Python library for PDF form processing.
It allows filling a PDF form programmatically by creating
a Python dictionary with keys matching its annotated names
for elements like text fields and checkboxes. It also supports other functionalities such as
drawing image and merging multiple PDFs together.
## Installing
Install using [pip](https://pip.pypa.io/en/stable/):
```shell script
pip install PyPDFForm
```
## Quick Example
![Check out the GitHub repository for a live demo if you can't see it here.](https://github.com/chinapandaman/PyPDFForm/raw/master/demo.gif)
A sample PDF form can be found [here](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/sample_template.pdf). Download it and try:
```python
import os
from PyPDFForm import PyPDFForm
PATH_TO_DOWNLOADED_SAMPLE_PDF_FORM = os.path.join(
os.path.expanduser("~/Downloads"), "sample_template.pdf"
) # Change this to where you downloaded the sample PDF form
PATH_TO_FILLED_PDF_FORM = os.path.join(
os.path.expanduser("~"), "output.pdf"
) # Change this to where you wish to put your filled PDF form
with open(PATH_TO_FILLED_PDF_FORM, "wb+") as output:
output.write(
PyPDFForm(PATH_TO_DOWNLOADED_SAMPLE_PDF_FORM)
.fill(
{
"test": "test_1",
"check": True,
"test_2": "test_2",
"check_2": False,
"test_3": "test_3",
"check_3": True,
},
)
.read()
)
```
After running the above code snippet you can find `output.pdf` at the location you specified,
and it should look like [this](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/sample_filled.pdf).
## Documentation
[Examples](https://github.com/chinapandaman/PyPDFForm/blob/master/docs/examples.md)
## How to Contribute
If you wish to improve this library, there is one specific way you can contribute
on top of the usual open source project norms such as issues and pull requests.
It is difficult to make sure that the library supports all the PDF form creating tools out
there. So if you run into a case where the library does not work for certain PDF forms created by
certain tools, feel free to open an issue with the problematic PDF form attached. I will seek
to make the library support the attached PDF form as well as the tool used to create it.
%prep
%autosetup -n PyPDFForm-1.2.8
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-PyPDFForm -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Mon May 15 2023 Python_Bot - 1.2.8-1
- Package Spec generated