Skip to main content

Convert docx to pdf on Windows or macOS directly using Microsoft Word (must be installed).

Project description



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


On macOS:

brew install aljohri/-/docx2pdf

Via pipx:

pipx install docx2pdf

Via pip:

pip install docx2pdf


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


from docx2pdf import convert

convert("input.docx", "output.pdf")

See CLI docs above (or in docx2pdf --help) for all the different invocations. It is the same for the CLI and python library.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for docx2pdf, version 0.1.7
Filename, size File type Python version Upload date Hashes
Filename, size docx2pdf-0.1.7-py3-none-any.whl (6.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size docx2pdf-0.1.7.tar.gz (6.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page