Hey folks!

The post may be a bit long. Please bear with me.

I am the developer of BentoPDF. It's a privacy first PDF toolkit that runs in your browser. I also have been working on making the best open source PDF compression engine, Hyper Compress, which is the what the post is about.

Why Hyper?

If you've ever needed to shrink a PDF you've almost certainly used Ghostscript. Even though it's great, but it rebuilds the whole document from scratch, so it can leave visual artefacts behind, and in our tests on 2,104 real PDFs it broke about 3% of files and made a quarter of them bigger.

Benchmark against open source tools

Hyper helps solve this issue. It is a high fidelity, monotonic compression engine. On those same 2,104 PDFs it beat Ghostscript, MuPDF and qpdf on size at every level, without making a single file bigger, and thus providing predictable outcome all while producing a conformant PDF.

Benchmark against commercial SDKs

For the new release I also ran a comparison against the commercial SDKs companies pay for. Hyper was tested against PDF Tools, Apryse and Nutrient on 1,000 real PDFs from public sources. The table shows size saved, with page quality after the @ (SSIMULACRA2, where 100 means identical to the original):

| Engine | Lossless | 200 dpi | 150 dpi | 72 dpi | |


|


|


|


|


| | Hyper | 18.0% @ 99.5 | 61.0% @ 89.8 | 70.2% @ 86.4 | 79.9% @ 67.9 | | PDF Tools | N/A | 55.1% @ 86.7 | 64.7% @ 82.9 | 75.6% @ 72.2 | | Apryse | N/A | 41.8% @ 88.4 | 55.6% @ 85.8 | 74.6% @ 73.4 | | Nutrient | N/A | 55.2% @ 87.8 | 61.5% @ 82.8 | 72.0% @ 70.8 |

Hyper made the smallest files at every level, and it's the only one with a lossless mode. Across its 4,000 runs it never failed and never made a file bigger. The others made between 5 and 120 files bigger, and Apryse and Nutrient failed on a few. At 72 dpi they keep a bit more quality, because they compress less.

But please Don't take my word for it. The list of PDFs with checksums, every per file result and the scripts are all in bench/sdk-comparison, so you can run it yourself.

It's available in CLI, Node SDK, C API, Docker, and can also run in your browser via WASM.

If you wanna quickly try it out: https://hyper.bentopdf.com/

It runs on your own browser via WASM, so nothing is uploaded.

I'd like to get more people testing it, especially with PDFs I haven't encountered myself. So if you work with PDFs regularly, I'd love for you to throw some difficult files at it and try and break it.

Any feedback and bug report is welcome and appreciated.

Thanks for reading and have a great day.

all 15 comments

sorted by: hot top controversial new old
[–] 11 points 10 hours ago (1 child)

It’s my favorite! I prefer it over Stirling.

  • source
  • hideshow 1 child comment
  • [–] 2 points 9 hours ago* (1 child)

    I haven’t dug into it yet, but does pdf compression strip screen readers’ ability to read the pdf? Like if I have alt text embedded in a pdf for a screen reader to be able to read, does it strip that out?

    Asking because I try to keep ADA compliance in mind, regarding things like text on images. PDFs are great for keeping a page formatted exactly as intended… But they’re fucking awful from an accessibility standpoint, because screen readers typically can’t interpret them.

    The go-to solution is to embed alt text that describes what is on the pdf. Because a screen reader can interpret alt text. But lots of sites (and I’m assuming compression methods) seem to strip this, for some reason.

  • source
  • hideshow 1 child comment
  • [–] 2 points 9 hours ago (1 child)

    I've been using BentoPDF for yonks, and have been deploying it for clients too.

    Thanks for your work!

  • source
  • hideshow 1 child comment
  • [–] 2 points 6 hours ago (1 child)

    I use bentopdf for a few months now, it's great thx for making it. One thing I wanted to ask is, is there a way to convert multiple images into separate PDF files in one go? When I add multiples I get a single file of them merged

  • source
  • hideshow 1 child comment
  • [–] 2 points 5 hours ago (1 child)

    I don't need to edit PDFs very often but I happily host BentoPDF just in case.

    But a major feature I need is signing with a CAC. I noticed you said something in the past that it may not be feasible?

  • source
  • hideshow 1 child comment
  • [–] 1 point 2 hours ago (2 children)
  • [–] [S] 3 points 1 hour ago (1 child)

    AI wasn't used for writing code. But its used for two things

    1. Generating a large number of malformed PDFs that break the compression
    2. As a second judge to compare the compression result, as going through 12k pdfs by myself was infeasible. However I did go through 2k of them by myself
    😙 1
  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 54 minutes ago (1 child)

    Is this program also within the normal BentoPDF? Thanks!

  • source
  • hideshow 1 child comment