Skip to main content

docx2pdf

PyPI

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.pdf

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

Metadata

Release files for docx2pdf-markup 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docx2pdf-markup 0.1.9
File Size Uploaded
docx2pdf_markup-0.1.9.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for docx2pdf-markup 0.1.9
File Interpreter ABI Platform
docx2pdf_markup-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 13.4 kB

Release files / docx2pdf_markup-0.1.9.tar.gz

Download URL docx2pdf_markup-0.1.9.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f264edfbd6aad81210106181454887c42b198b354eca064303b2281c9734f715
BLAKE2b-256 checksum
How to use checksums
6a667a4791ff12707c951bf083cf90f62684c79e4f6fc0127eae3207dc32fd43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / docx2pdf_markup-0.1.9-py3-none-any.whl

Download URL docx2pdf_markup-0.1.9-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46c4fcac4307e0c4e12b038e160c848a6d6f668f29a4273adbb852f632e0e03b
BLAKE2b-256 checksum
How to use checksums
6bab508c57ede79ab97f6c30ea4490eb7fd66bbb35d94ea2584b0e38c806b13c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.1.9 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page