docx2pdf
Convert docx to pdf on Windows or macOS directly using Microsoft Word (must be installed).
On Windows, this is implemented via win32com while on macOS this is implemented via JXA (Javascript for Automation, aka AppleScript in JS).
Install
On macOS:
brew install aljohri/-/docx2pdf
Via 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
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
``
Release files for docx2pdf 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| docx2pdf-0.1.8.tar.gz | 6.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| docx2pdf-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.2 kB
Release files / docx2pdf-0.1.8.tar.gz
| Download URL | docx2pdf-0.1.8.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d2c20f9ad36eec75f4da017dc7a97622946954a6124ca0b11772875fa86fbed
|
|
BLAKE2b-256 checksum How to use checksums |
ab5d112531fff53cf60513e14fa1707755c874d47880ec4de7b2235302ad19a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.10.1 Windows/10
|
Release files / docx2pdf-0.1.8-py3-none-any.whl
| Download URL | docx2pdf-0.1.8-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
00be1401fd486640314e993423a0a1cbdbc21142186f68549d962d505b2e8a12
|
|
BLAKE2b-256 checksum How to use checksums |
534f1155781308281e67f80b829738a29e5354e03664c62311f753056afc873b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.10.1 Windows/10
|