whatsapp-chat-to-pdf
Convert an exported WhatsApp chat (_chat.txt or .zip) into a clean, styled PDF — from the command line.
A small, dependency-light tool for turning a WhatsApp chat export into a readable PDF
document. Available as a Python package (pip install whatsapp-chat-to-pdf) and a
Node / npm package (npx whatsapp-chat-to-pdf). Works offline, on your own machine — your
conversations never leave your computer.
💡 Don't want to install anything? If you'd rather drop in a chat export and get a media-rich PDF in your browser — with images, voice notes, emoji and pixel-perfect WhatsApp formatting — use the hosted converter at chattopdf.app. This CLI covers the text/offline case; the web app covers everything else.
Why this exists
Most open-source WhatsApp exporters output raw HTML or JSON. This one is built for the most common real-world need: a tidy PDF you can read, print, archive or email — a chat log, a keepsake, or a record for your files.
The hard part of parsing WhatsApp exports is that the _chat.txt timestamp format changes by
device, locale and language. This parser handles 14 timestamp formats out of the box,
including:
- iOS bracketed —
[2024/07/09, 08:01:49] Name: …and[2026-03-02, 6:39:22 AM] … - Android dashed —
3/15/24, 2:30 PM - Name: … - European dotted —
15.03.2024, 14:30 - Name: … - Dutch / Brazilian / Spanish iOS / ISO variants
- Non-Western numerals (Arabic, Persian, Devanagari/Hindi, Thai)
- CJK / Arabic / Persian AM-PM markers (上午/下午, 午前/午後, 오전/오후, ص/م, ق.ظ/ب.ظ)
It also correctly classifies media, calls, deleted and system messages, stitches multi-line
messages back together, and skips the macOS ._chat.txt resource-fork that silently corrupts
many other parsers.
Install & use
Python
pip install whatsapp-chat-to-pdf
whatsapp-chat-to-pdf _chat.txt -o my-chat.pdf
Or use it as a library:
from whatsapp_chat_to_pdf import parse_file, render
chat = parse_file("WhatsApp Chat with Alice.zip")
print(chat.message_count, "messages from", chat.participants)
render(chat, "alice.pdf", title="Chat with Alice")
Node / npm
npx whatsapp-chat-to-pdf _chat.txt -o my-chat.pdf
# or: npm i -g whatsapp-chat-to-pdf
import { parseText, render } from "whatsapp-chat-to-pdf";
const chat = parseText(fs.readFileSync("_chat.txt", "utf8"));
await render(chat, "out.pdf", { title: "Chat with Alice" });
How to get the _chat.txt export from WhatsApp
- Open the chat → tap the contact/group name.
- Scroll down → Export Chat → Without Media (or With Media for the
.zip). - Save the
.txt/.zipto your computer. - Run the command above.
(Full step-by-step with screenshots for iPhone & Android: chattopdf.app guide.)
Scope
| This CLI | chattopdf.app (hosted) | |
|---|---|---|
| Text → styled PDF, offline | ✅ | ✅ |
| 14 locale/date formats | ✅ | ✅ |
| Inline images & media | — | ✅ |
| Voice-note transcription | — | ✅ |
| Full emoji & CJK glyphs | — | ✅ |
| No install, runs in browser | — | ✅ |
Emoji and CJK render as the bundled DejaVu font allows; for full fidelity use the hosted version.
Contributing
Issues and PRs welcome — especially new timestamp formats from locales not yet covered.
Drop a sample of the offending _chat.txt header line in an issue.
License
MIT — see LICENSE.
Metadata
Release files for whatsapp-chat-to-pdf 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| whatsapp_chat_to_pdf-0.1.0.tar.gz | 742.2 kB | Without provenance | Details for whatsapp_chat_to_pdf-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| whatsapp_chat_to_pdf-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for whatsapp_chat_to_pdf-0.1.0-py3-none-any.whl |
Total release size: 1.5 MB
Release files / whatsapp_chat_to_pdf-0.1.0.tar.gz
| Download URL | whatsapp_chat_to_pdf-0.1.0.tar.gz |
|---|---|
| Size | 742.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e250e40ed8304a941bd795cd77ac5ca45a29079d159293c8623f6b571ef599d6
|
|
BLAKE2b-256 checksum How to use checksums |
5eefdf18d712aef636c5b83120e8b55cfa0c635d2516034af9e7fe3475b52615
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / whatsapp_chat_to_pdf-0.1.0-py3-none-any.whl
| Download URL | whatsapp_chat_to_pdf-0.1.0-py3-none-any.whl |
|---|---|
| Size | 742.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
772984c51970f5a82c25fb1acaf2f21d188664ac6ffa5bc00ff46ec7a469820b
|
|
BLAKE2b-256 checksum How to use checksums |
06ec8a0b711c58b736e1bb41aba8ebdbc3631531f1706b855eee1c8c1685fb2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for whatsapp-chat-to-pdf 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.