Convert Outlook msg to PDF
Project description
Converts Outlook .msg files to PDF
msgtopdf
is a Python 3 module to convert Outlook .msg
files to PDF and extract the attachments. Unlike the majority of current modules msgtopdf
maintains the formatting of HTML and RTF messages and embeds any inline images in the PDF output.
As the module uses the win32com
library the host machine must have Outlook installed.
msgtopdf
uses the wkhtmltopdf tool to convert the HTML message to PDF and wkhtmltopdf must be installed separately.
Currently msgtopdf
extracts the message body and attachments to a new subfolder using the subject of the email as the folder name.
Usage
Module Usage
Example module usage is provided in the tests/example.py
file.
Command Line Usage
The command-line option msg2pdf
will convert individual files or all *.msg
files in a directory.
msg2pdf --help
for options.
Usage: msg2pdf [OPTIONS] PATH
msg2pdf converts Outlook email messages (msg) to pdf.
The output is a folder for each email using the email subject as the
folder name including a pdf of the email and all attachments.
Inline images are included in the email pdf.
Options:
-f, --file Convert an individual file PATH to pdf.
-d, --directory Convert all msg files in directory PATH to pdf.
--help Show this message and exit.
Requirements
Install the Windows binary release of wkhtmltopdf
Ensure that wkhtmltopdf
command is found in your PATH
.
This can be tested by entering wkhtmltopdf --version
in your Command Prompt.
You should receive an output similar to the attached.
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\>wkhtmltopdf --version
wkhtmltopdf 0.12.5 (with patched qt)
C:\>
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
Built Distribution
File details
Details for the file msgtopdf-0.1.3.tar.gz
.
File metadata
- Download URL: msgtopdf-0.1.3.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad830e57c2e645f03d1089a81c8f62591abf537a171c1ff4b44e6eee4a3bd436 |
|
MD5 | f21210b9d10cdf5c974cc73c6b45cab5 |
|
BLAKE2b-256 | efe3ebd80f14f2d9c1009c87b6e8429b9f1fc1f8466c1a3d1e1733f257346ebc |
File details
Details for the file msgtopdf-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: msgtopdf-0.1.3-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0240aa4c47c801f74f7be79997f42d0e71d193b807356dd35dd81f68816ad5f7 |
|
MD5 | 087ad2318592a75ea526532dea3f1cd4 |
|
BLAKE2b-256 | c7d640ba52f3c415eb189710257d2d76735a92fea3005be7013a72e1eac04fbf |