gitmyhub

marker_epub

Python ★ 0 updated 21d ago

marker but epub~

A Python plugin for the marker PDF-conversion tool that turns its HTML output into a proper EPUB e-book with chapters, a table of contents, and images.

Pythonmarker-pdfBeautifulSoupEbookLibsetup: easycomplexity 2/5

Marker-EPUB is a Python add-on for an existing tool called marker, which converts PDF documents into other formats. Where the original marker tool focuses on turning PDFs into HTML, this plugin takes that HTML output one step further and packages it into a proper EPUB file, the format used by most e-readers and reading apps.

A few specific problems are solved here. First, it looks for heading tags in the converted document and uses them to automatically split the book into real chapters, which also lets it build a working table of contents instead of leaving the reader with one long unbroken file. Second, it fixes a common e-reader display issue where wide tables get cut off or disappear on small screens, by wrapping tables in scrollable containers so they remain visible and usable. Third, it carries over any images that marker already extracted from the original PDF, so illustrations and figures are not lost in the conversion.

To use it, you first need marker itself installed, since this tool is built as a wrapper around it rather than a replacement. After installing this package, you run a command called marker_epub the same way you would normally run marker's own command, pointing it at a PDF file and optionally telling it where to save the output.

Under the hood, the tool calls marker to do the initial PDF-to-HTML conversion, then uses a library called BeautifulSoup to clean up and break the HTML into valid chapter segments, and finally uses another library called EbookLib to assemble everything into a finished EPUB file, complete with a reading order, table of contents, and styling that adapts to different screen sizes.

Where it fits