Metadata-Version: 2.4
Name: kakemono
Version: 0.5.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Rust
Classifier: Topic :: Text Processing :: Markup :: HTML
Summary: Convert PDF papers and books into clean, readable HTML (pure Rust, no poppler or mupdf)
Keywords: pdf,html,arxiv,converter,papers
Author: Cao Minh Tiến
License-Expression: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Changelog, https://github.com/iamcaominhtien/kakemono/blob/main/CHANGELOG.md
Project-URL: Homepage, https://github.com/iamcaominhtien/kakemono
Project-URL: Repository, https://github.com/iamcaominhtien/kakemono

# kakemono for Python

Convert PDF papers and books (a local file or an arXiv id) into clean, readable HTML or Word
documents, from Python. The conversion is done by the [kakemono](https://github.com/iamcaominhtien/kakemono) Rust
library, bundled in the wheel: no poppler, mupdf or other system dependency.

```bash
pip install kakemono
```

```python
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)
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` and `jobs`. They match the
command-line options described in the [main README](https://github.com/iamcaominhtien/kakemono#usage).

`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.

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

MIT license.

