MCPcopy Index your code
hub / github.com/LaurenzV/hayro

github.com/LaurenzV/hayro @hayro-jpeg2000-v0.4.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release hayro-jpeg2000-v0.4.0 ↗ · + Follow
4,570 symbols 11,088 edges 208 files 476 documented · 10% updated 2d ago★ 69919 open issues

Browse by type

Functions 3,975 Types & classes 595
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

hayro

Crates.io Documentation

An experimental, work-in-progress PDF interpreter and renderer.

hayro is a Rust crate with a simple task: It allows you to interpret one or many pages of a PDF file to for example convert them into PNG or SVG files. This is a difficult task, as the PDF specification is huge and contains many features. In addition to that, there are millions of PDF files out there with many edge cases, so a solid PDF renderer should be able to handle those as well as possible.

This is not the first attempt at writing a PDF renderer in Rust, but, to the best of my knowledge, this is currently the most feature-complete library. There are still certain features and edge cases that hayro currently doesn't support (for example rendering knockout groups or PDFs with non-embedded CID-fonts). However, the vast majority of common features is supported meaning that you should be able to render the "average" PDF file without encountering any issues. This statement is underpinned by the fact that hayro is able to handle the 1400+ PDFs in our test suite, which to a large part have been scraped from the PDFBOX and pdf.js test regression suites.

But, this crate is still in a very development stage, and there are issues that remain to be addressed, most notably performance, which has not been a focus at all so far but will become a priority in the near future.

Crates

While the main goal of hayro is rendering PDF files, the hayro project actually encompasses a number of different crates which can in theory used independently. These include: - hayro-syntax: Low-level parsing and reading of PDF files. - hayro-interpret: A PDF interpreter emitting commands into an abstract Device. - hayro: Rendering PDF pages into bitmaps. - hayro-svg: Converting PDF pages into SVG images. - hayro-jpeg2000: A JPEG2000 image decoder. - hayro-jbig2: A JBIG2 image decoder. - hayro-ccitt: A decoder for group 3 and group 4 CCITT-encoded images. - hayro-postscript: A lightweight scanner for a specific subset of PostScript. - hayro-cmap: A parser for CMap files in PDFs.

Demo

A demo tool can be found at https://laurenzv.github.io/hayro/. Please note that this is not intended to be a PDF viewer application: It misses many important features like zooming, selecting text and important optimizations for improving the user experience. It's really just meant as a quick way to test the rendering capabilities of hayro.

Minimum Supported Rust Version (MSRV)

The minimum supported Rust version is 1.92.

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Function 2,650
Method 1,325
Class 434
Enum 126
Interface 35

Languages

Rust99%
Python1%
TypeScript1%

Modules by API surface

hayro-tests/tests/render.rs1,517 symbols
hayro-tests/tests/load.rs117 symbols
hayro-jpeg2000/src/j2c/bitplane.rs79 symbols
hayro-cmap/src/lib.rs73 symbols
hayro-syntax/src/content/ops_generated.rs71 symbols
hayro-interpret/src/function/type4.rs66 symbols
hayro-interpret/src/color.rs62 symbols
hayro-syntax/src/filter/lzw_flate.rs52 symbols
hayro-jpeg2000/src/j2c/codestream.rs48 symbols
hayro-syntax/src/xref.rs44 symbols
hayro-postscript/src/string.rs44 symbols
hayro-syntax/src/bit_reader.rs43 symbols

For agents

$ claude mcp add hayro \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page