Skip to main content

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 used 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 named using the emails subject.


Example usage is provided in the tests/ file. The next plan on the timeline is to create a command line tool in which the user provides either a filename -f or directory -d and msgtopdf will process either a single msg file or all msg files in a directory.


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


Project details

Release history Release notifications

Download files

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

Files for msgtopdf, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size msgtopdf-0.0.1-py3-none-any.whl (4.4 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size msgtopdf-0.0.1.tar.gz (3.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page