docx2pdf


Namedocx2pdf JSON
Version 0.1.8 PyPI version JSON
download
home_pagehttps://github.com/AlJohri/docx2pdf
SummaryConvert docx to pdf on Windows or macOS directly using Microsoft Word (must be installed).
upload_time2021-12-11 16:56:36
maintainer
docs_urlNone
authorAl Johri
requires_python>=3.5
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # docx2pdf

[![PyPI](https://img.shields.io/pypi/v/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
``

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/AlJohri/docx2pdf",
    "name": "docx2pdf",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": "",
    "keywords": "",
    "author": "Al Johri",
    "author_email": "al.johri@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ab/5d/112531fff53cf60513e14fa1707755c874d47880ec4de7b2235302ad19a0/docx2pdf-0.1.8.tar.gz",
    "platform": "",
    "description": "# docx2pdf\n\n[![PyPI](https://img.shields.io/pypi/v/docx2pdf)](https://pypi.org/project/docx2pdf/)\n\nConvert `docx` to `pdf` on Windows or macOS directly using Microsoft Word (must be installed).\n\nOn 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).\n\n## Install\n\nOn macOS:\n\n```\nbrew install aljohri/-/docx2pdf\n```\n\nVia [pipx](https://pipxproject.github.io/pipx/):\n\n```\npipx install docx2pdf\n```\n\nVia pip:\n\n```\npip install docx2pdf\n```\n\n## CLI\n\n```\nusage: docx2pdf [-h] [--keep-active] [--version] input [output]\n\nExample Usage:\n\nConvert single docx file in-place from myfile.docx to myfile.pdf:\n    docx2pdf myfile.docx\n\nBatch convert docx folder in-place. Output PDFs will go in the same folder:\n    docx2pdf myfolder/\n\nConvert single docx file with explicit output filepath:\n    docx2pdf input.docx output.docx\n\nConvert single docx file and output to a different explicit folder:\n    docx2pdf input.docx output_dir/\n\nBatch convert docx folder. Output PDFs will go to a different explicit folder:\n    docx2pdf input_dir/ output_dir/\n\npositional arguments:\n  input          input file or folder. batch converts entire folder or convert\n                 single file\n  output         output file or folder\n\noptional arguments:\n  -h, --help     show this help message and exit\n  --keep-active  prevent closing word after conversion\n  --version      display version and exit\n```\n\n## Library\n\n```python\nfrom docx2pdf import convert\n\nconvert(\"input.docx\")\nconvert(\"input.docx\", \"output.pdf\")\nconvert(\"my_docx_folder/\")\n```\n\nSee CLI docs above (or in `docx2pdf --help`) for all the different invocations. It is the same for the CLI and python library.\n\n## Jupyter Notebook\n\nIf you are using this in the context of jupyter notebook, you will need `ipywidgets` for the tqdm progress bar to render properly.\n\n```\npip install ipywidgets\njupyter nbextension enable --py widgetsnbextension\n``\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Convert docx to pdf on Windows or macOS directly using Microsoft Word (must be installed).",
    "version": "0.1.8",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "534f1155781308281e67f80b829738a29e5354e03664c62311f753056afc873b",
                "md5": "450e166cb94f53676d0baa95ce05a738",
                "sha256": "00be1401fd486640314e993423a0a1cbdbc21142186f68549d962d505b2e8a12"
            },
            "downloads": -1,
            "filename": "docx2pdf-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "450e166cb94f53676d0baa95ce05a738",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 6741,
            "upload_time": "2021-12-11T16:56:35",
            "upload_time_iso_8601": "2021-12-11T16:56:35.163215Z",
            "url": "https://files.pythonhosted.org/packages/53/4f/1155781308281e67f80b829738a29e5354e03664c62311f753056afc873b/docx2pdf-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ab5d112531fff53cf60513e14fa1707755c874d47880ec4de7b2235302ad19a0",
                "md5": "a33ac72515f4706e4ea46167a0827c47",
                "sha256": "6d2c20f9ad36eec75f4da017dc7a97622946954a6124ca0b11772875fa86fbed"
            },
            "downloads": -1,
            "filename": "docx2pdf-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "a33ac72515f4706e4ea46167a0827c47",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 6483,
            "upload_time": "2021-12-11T16:56:36",
            "upload_time_iso_8601": "2021-12-11T16:56:36.750410Z",
            "url": "https://files.pythonhosted.org/packages/ab/5d/112531fff53cf60513e14fa1707755c874d47880ec4de7b2235302ad19a0/docx2pdf-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-12-11 16:56:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "AlJohri",
    "github_project": "docx2pdf",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "docx2pdf"
}
        
Elapsed time: 0.12290s