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:\>
Release files for msgtopdf 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| msgtopdf-0.1.6.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| msgtopdf-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.0 kB
Release files / msgtopdf-0.1.6.tar.gz
| Download URL | msgtopdf-0.1.6.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cdf87520c1c14a519a3bf62e4fda7c9c7d03c95a28cc6fc78f4130582d4fd5f4
|
|
BLAKE2b-256 checksum How to use checksums |
d4aceaa30237c2ae1bf383a75afff3c4f0b20b44fbfbeadabb9b1b5476fa2ca1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5
|
Release files / msgtopdf-0.1.6-py3-none-any.whl
| Download URL | msgtopdf-0.1.6-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
75f036355d935ebb365b4c9aeeb1fb04933683b9e37d1ff9e77be233e84695e1
|
|
BLAKE2b-256 checksum How to use checksums |
2859caa876cb17a713af4fe785e40180ae9c6200ae165db96d235853e58085d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5
|