diff options
Diffstat (limited to 'python-docx2pdf.spec')
| -rw-r--r-- | python-docx2pdf.spec | 319 |
1 files changed, 319 insertions, 0 deletions
diff --git a/python-docx2pdf.spec b/python-docx2pdf.spec new file mode 100644 index 0000000..246ce27 --- /dev/null +++ b/python-docx2pdf.spec @@ -0,0 +1,319 @@ +%global _empty_manifest_terminate_build 0 +Name: python-docx2pdf +Version: 0.1.8 +Release: 1 +Summary: Convert docx to pdf on Windows or macOS directly using Microsoft Word (must be installed). +License: MIT +URL: https://github.com/AlJohri/docx2pdf +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/ab/5d/112531fff53cf60513e14fa1707755c874d47880ec4de7b2235302ad19a0/docx2pdf-0.1.8.tar.gz +BuildArch: noarch + +Requires: python3-pywin32 +Requires: python3-tqdm +Requires: python3-importlib_metadata +Requires: python3-appscript + +%description +# docx2pdf + +[](https://pypi.org/project/docx2pdf/) + +Convert `docx` to `pdf` on Windows or macOS directly using Microsoft Word (must be installed). + +On Windows, this is implemented via [`win32com`](https://pypi.org/project/pywin32/) while on macOS this is implemented via [JXA](https://github.com/JXA-Cookbook/JXA-Cookbook) (Javascript for Automation, aka AppleScript in JS). + +## Install + +On macOS: + +``` +brew install aljohri/-/docx2pdf +``` + +Via [pipx](https://pipxproject.github.io/pipx/): + +``` +pipx install docx2pdf +``` + +Via pip: + +``` +pip install docx2pdf +``` + +## CLI + +``` +usage: docx2pdf [-h] [--keep-active] [--version] input [output] + +Example Usage: + +Convert single docx file in-place from myfile.docx to myfile.pdf: + docx2pdf myfile.docx + +Batch convert docx folder in-place. Output PDFs will go in the same folder: + docx2pdf myfolder/ + +Convert single docx file with explicit output filepath: + docx2pdf input.docx output.docx + +Convert single docx file and output to a different explicit folder: + docx2pdf input.docx output_dir/ + +Batch convert docx folder. Output PDFs will go to a different explicit folder: + docx2pdf input_dir/ output_dir/ + +positional arguments: + input input file or folder. batch converts entire folder or convert + single file + output output file or folder + +optional arguments: + -h, --help show this help message and exit + --keep-active prevent closing word after conversion + --version display version and exit +``` + +## Library + +```python +from docx2pdf import convert + +convert("input.docx") +convert("input.docx", "output.pdf") +convert("my_docx_folder/") +``` + +See CLI docs above (or in `docx2pdf --help`) for all the different invocations. It is the same for the CLI and python library. + +## Jupyter Notebook + +If you are using this in the context of jupyter notebook, you will need `ipywidgets` for the tqdm progress bar to render properly. + +``` +pip install ipywidgets +jupyter nbextension enable --py widgetsnbextension +`` + + +%package -n python3-docx2pdf +Summary: Convert docx to pdf on Windows or macOS directly using Microsoft Word (must be installed). +Provides: python-docx2pdf +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-docx2pdf +# docx2pdf + +[](https://pypi.org/project/docx2pdf/) + +Convert `docx` to `pdf` on Windows or macOS directly using Microsoft Word (must be installed). + +On Windows, this is implemented via [`win32com`](https://pypi.org/project/pywin32/) while on macOS this is implemented via [JXA](https://github.com/JXA-Cookbook/JXA-Cookbook) (Javascript for Automation, aka AppleScript in JS). + +## Install + +On macOS: + +``` +brew install aljohri/-/docx2pdf +``` + +Via [pipx](https://pipxproject.github.io/pipx/): + +``` +pipx install docx2pdf +``` + +Via pip: + +``` +pip install docx2pdf +``` + +## CLI + +``` +usage: docx2pdf [-h] [--keep-active] [--version] input [output] + +Example Usage: + +Convert single docx file in-place from myfile.docx to myfile.pdf: + docx2pdf myfile.docx + +Batch convert docx folder in-place. Output PDFs will go in the same folder: + docx2pdf myfolder/ + +Convert single docx file with explicit output filepath: + docx2pdf input.docx output.docx + +Convert single docx file and output to a different explicit folder: + docx2pdf input.docx output_dir/ + +Batch convert docx folder. Output PDFs will go to a different explicit folder: + docx2pdf input_dir/ output_dir/ + +positional arguments: + input input file or folder. batch converts entire folder or convert + single file + output output file or folder + +optional arguments: + -h, --help show this help message and exit + --keep-active prevent closing word after conversion + --version display version and exit +``` + +## Library + +```python +from docx2pdf import convert + +convert("input.docx") +convert("input.docx", "output.pdf") +convert("my_docx_folder/") +``` + +See CLI docs above (or in `docx2pdf --help`) for all the different invocations. It is the same for the CLI and python library. + +## Jupyter Notebook + +If you are using this in the context of jupyter notebook, you will need `ipywidgets` for the tqdm progress bar to render properly. + +``` +pip install ipywidgets +jupyter nbextension enable --py widgetsnbextension +`` + + +%package help +Summary: Development documents and examples for docx2pdf +Provides: python3-docx2pdf-doc +%description help +# docx2pdf + +[](https://pypi.org/project/docx2pdf/) + +Convert `docx` to `pdf` on Windows or macOS directly using Microsoft Word (must be installed). + +On Windows, this is implemented via [`win32com`](https://pypi.org/project/pywin32/) while on macOS this is implemented via [JXA](https://github.com/JXA-Cookbook/JXA-Cookbook) (Javascript for Automation, aka AppleScript in JS). + +## Install + +On macOS: + +``` +brew install aljohri/-/docx2pdf +``` + +Via [pipx](https://pipxproject.github.io/pipx/): + +``` +pipx install docx2pdf +``` + +Via pip: + +``` +pip install docx2pdf +``` + +## CLI + +``` +usage: docx2pdf [-h] [--keep-active] [--version] input [output] + +Example Usage: + +Convert single docx file in-place from myfile.docx to myfile.pdf: + docx2pdf myfile.docx + +Batch convert docx folder in-place. Output PDFs will go in the same folder: + docx2pdf myfolder/ + +Convert single docx file with explicit output filepath: + docx2pdf input.docx output.docx + +Convert single docx file and output to a different explicit folder: + docx2pdf input.docx output_dir/ + +Batch convert docx folder. Output PDFs will go to a different explicit folder: + docx2pdf input_dir/ output_dir/ + +positional arguments: + input input file or folder. batch converts entire folder or convert + single file + output output file or folder + +optional arguments: + -h, --help show this help message and exit + --keep-active prevent closing word after conversion + --version display version and exit +``` + +## Library + +```python +from docx2pdf import convert + +convert("input.docx") +convert("input.docx", "output.pdf") +convert("my_docx_folder/") +``` + +See CLI docs above (or in `docx2pdf --help`) for all the different invocations. It is the same for the CLI and python library. + +## Jupyter Notebook + +If you are using this in the context of jupyter notebook, you will need `ipywidgets` for the tqdm progress bar to render properly. + +``` +pip install ipywidgets +jupyter nbextension enable --py widgetsnbextension +`` + + +%prep +%autosetup -n docx2pdf-0.1.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-docx2pdf -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed Apr 12 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.8-1 +- Package Spec generated |
