Skip to main content

kakemono for Python

Convert PDF papers and books (a local file or an arXiv id) into clean, readable HTML, Word documents, Markdown, LaTeX, EPUB books or editable JSON, from Python. The conversion is done by the kakemono Rust library, bundled in the wheel: no poppler, mupdf or other system dependency.

pip install kakemono
import kakemono

html = kakemono.convert("paper.pdf")                       # friendly mode, one self-contained page
html = kakemono.convert("1706.03762", mode="medium")       # an arXiv id or URL works too
pages = kakemono.convert_all("paper.pdf")                  # {"hard": ..., "hard-95": ..., "medium": ..., "friendly": ...}
kakemono.to_docx("paper.pdf", "paper.docx")               # a Word document (also returns its bytes)
text = kakemono.to_markdown("paper.pdf", "paper.md")       # Markdown, pictures in paper_assets/
tex = kakemono.to_latex("paper.pdf", "paper.tex")          # LaTeX, pictures in paper_assets/
book = kakemono.to_epub("paper.pdf", "paper.epub")         # an EPUB book (also returns its bytes)
content = kakemono.to_json("paper.pdf", "paper.json")      # the editable JSON, as a dict
doc = kakemono.analyze(open("paper.pdf", "rb").read())     # the structure: blocks in reading order
Mode What you get
hard Each page redrawn as SVG/PNG, with a hidden selectable text layer
hard-95 The same pages, with visible HTML text placed as in the PDF
medium Pages and columns kept, text reflowed
friendly One responsive column with themes, contents, a phone layout and a book view

Options of convert and convert_all: tables, equations ("mathml" or "image"), page_image ("svg", "svg-only", "png"), embed_fonts, scale, jobs and png_compression. They match the command-line options described in the main README.

Every conversion function (all but analyze) also takes png_compression: "balanced" (default), "fast" (pictures drawn several times faster, PNG files about a quarter larger: for many documents on a slow machine) or "high" (about a tenth smaller, ten times slower). The pixels are the same at every level.

to_docx takes tables, equations, scale and jobs. Formulas whose structure is clear become Word equations (editable in Word), the others pictures; rebuilt tables become Word tables. With save_images=True the pictures are also written as files to image_dir (default <name>_assets, next to the document).

to_markdown takes the same options, plus image_dir (default <name>_assets, next to the file) and inline_images. Formulas whose structure is clear become LaTeX between $$, tables pipe tables. Without a path, or with inline_images=True, the pictures are embedded as data URIs.

to_latex takes tables, equations, scale, jobs and image_dir, and returns a LaTeX document that compiles with pdfLaTeX, XeLaTeX or LuaLaTeX: sections, tabular tables, LaTeX math. LaTeX cannot embed pictures, so they are written to image_dir next to the file; without a path, only the source is returned.

to_epub takes tables, equations, scale and jobs, plus max_math_width_em (displayed formulas wider than this, in multiples of the text size, become pictures; default 20), cover (the first page as the cover, on by default) and modified (the date recorded in the book, YYYY-MM-DDThh:mm:ssZ; by default, now). It returns an EPUB 3 book with one chapter per top-level section, a table of contents, MathML formulas and the pictures inside.

to_json takes the options of to_markdown and returns the editable JSON as a dict: the blocks in reading order, each with its type, section, layout and text, a string whose tags (<i>, <b>, <a href>, ...) keep the styles and links and where <m id="n"> stands for a formula. Every conversion function takes content: an edited copy of that JSON for the same PDF (the dict, its text or a path to it), whose text the output then shows. Translating a paper is editing the text fields:

content = kakemono.to_json("paper.pdf")
for block in content["blocks"]:
    if "text" in block:
        block["text"] = my_translate(block["text"])   # keep the tags
html = kakemono.convert("paper.pdf", "hard-95", content=content)   # the pages, translated
kakemono.to_docx("paper.pdf", "paper.vi.docx", content=content)

The JSON also has read-only fields for search and data extraction: plain on every block (the text without tags, formulas as $LaTeX$), citation on every reference (authors, title, venue, year, volume, pages, doi, arxiv, url, as far as they could be read) and, in meta, the authors (with indices into affiliations and author_notes, and their emails), arxiv_category, date, doi, keywords and abstract:

content = kakemono.to_json("1706.03762")
print([a["name"] for a in content["meta"]["authors"]])
refs = [b["citation"] for b in content["blocks"] if b.get("citation")]
print(refs[0]["title"], refs[0]["year"])

Blocks left unchanged keep their text; a block whose edited text cannot be read (an unknown tag) keeps its own, with a UserWarning. The hard mode cannot show edited text.

The GIL is released during a conversion, so several PDFs can be converted in parallel threads.

MIT license.

Metadata

Release files for kakemono 0.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kakemono 0.13.0
File Size Uploaded Provenance Actions
kakemono-0.13.0.tar.gz 2.3 MB With provenance Details for kakemono-0.13.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for kakemono 0.13.0
File Actions
kakemono-0.13.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for kakemono-0.13.0-cp39-abi3-win_amd64.whl
kakemono-0.13.0-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details for kakemono-0.13.0-cp39-abi3-manylinux_2_28_aarch64.whl
kakemono-0.13.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for kakemono-0.13.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
kakemono-0.13.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for kakemono-0.13.0-cp39-abi3-macosx_11_0_arm64.whl
kakemono-0.13.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for kakemono-0.13.0-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 74.3 MB

Release files / kakemono-0.13.0.tar.gz

Download URL kakemono-0.13.0.tar.gz
Size 2.3 MB
Tags Source
SHA-256 checksum
How to use checksums
5f68472e589c8956ebcb3a606fc4cdc33f5bb26d779483c8fab188cfd658bb6e
BLAKE2b-256 checksum
How to use checksums
e875315155c8b3d9136f363a9015f41f075e0072e1165c3ba4e157dc2d5d0f62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / kakemono-0.13.0-cp39-abi3-win_amd64.whl

Download URL kakemono-0.13.0-cp39-abi3-win_amd64.whl
Size 13.8 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
3663ca40b2ba8a747497993aa69d0d775c0cd6608c23d1d36346ef83569c4d74
BLAKE2b-256 checksum
How to use checksums
2e8afb04b043685fd13be58e26417d2852b342b56e8158ec2673a3ec0d3deb30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / kakemono-0.13.0-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL kakemono-0.13.0-cp39-abi3-manylinux_2_28_aarch64.whl
Size 15.0 MB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
f58ef6d505efce1deb7edb599abca844472a12d85bec9b9b6bba0adb2473588a
BLAKE2b-256 checksum
How to use checksums
420e8186b4c9a4201f3070df23c57c5ae4b1aed3bccfb4b4781edc72373b5cf5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / kakemono-0.13.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL kakemono-0.13.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 15.1 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
d164a85f06404fe2ccb8f47991cd45ecafebd7656d9baf386ed970588650f881
BLAKE2b-256 checksum
How to use checksums
37dd9e5d146f760cadad1a77342446fc0558461d7938bea842d6cce5caadb3d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / kakemono-0.13.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL kakemono-0.13.0-cp39-abi3-macosx_11_0_arm64.whl
Size 13.8 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e81206a4a69e3d9cd258b4c2fc941243597b2375195e7d1c6e51a6e2ec8a087d
BLAKE2b-256 checksum
How to use checksums
f83d9caf0b03fbc4e7e08e6310cefd5648fb43ed28b890ece8ff5cbc95ac1a12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / kakemono-0.13.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL kakemono-0.13.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 14.4 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
c661678a15596dcd43e6eeeed31f8f8c8d7390f6008c1992c0e759a6c6bb1890
BLAKE2b-256 checksum
How to use checksums
79102017c9435625ab10a7990a7bd795c35bac1928e26bffea97e9eaffe1c7e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for kakemono 0.13.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.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for kakemono-0.13.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page