Skip to main content

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

Project description

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

Project details


Download files

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

Source Distribution

docx2pdf-0.1.6.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

docx2pdf-0.1.6-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file docx2pdf-0.1.6.tar.gz.

File metadata

  • Download URL: docx2pdf-0.1.6.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.8.2 Windows/10

File hashes

Hashes for docx2pdf-0.1.6.tar.gz
Algorithm Hash digest
SHA256 f1aba21203fbc120b639e782ea235b68ab4792d65c90e62658f8366368c27515
MD5 60b90ec5fb7c323f5c79c5271336b243
BLAKE2b-256 54ee243158202d39b9a8b936b9c98491317ed5ec080c3ac517270efe39b141f5

See more details on using hashes here.

File details

Details for the file docx2pdf-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: docx2pdf-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.8.2 Windows/10

File hashes

Hashes for docx2pdf-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 49aedf0ef50821e31f370d649299d637573946713a99ca2295c11bf3ff243e47
MD5 a9ddef5d2b0d3d0d415ffa7cf868ac32
BLAKE2b-256 0df21f6d0e312a0bffedaae11d526502c2bd782fc7d223d752b0273358e0ee66

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page