all works
2025Personal projectLive

PDF Inverter

PDF dark mode without rasterizing the text


anshitsinha.github.ioopen site ↗
Live preview of PDF Inverter; activate to open the website
Role
Personal project
Year
2025
Built with
JavaScript · pdf-lib · HTML

Overview

PDF Inverter is a lightweight, client-side tool that turns PDFs into dark-mode versions while keeping text as real text. Naive inversion breaks on transparent backgrounds and on rasterized elements. This tool rebuilds each page layer by layer with blend modes instead.

Three layers

Each page is rebuilt from three layers. A solid white base fixes transparent backgrounds. The original page content goes on top of it. A final white rectangle in Difference blend mode inverts everything beneath it.

Not crashing

pdf-lib can throw on complex or corrupted documents. Each page is embedded as its own clean copy, so one bad page can't take down the whole file. The tool is one self-contained HTML file: drop a PDF in, preview it, download it.

Tech Stack

  • JavaScript
  • pdf-lib
  • HTML
  • Tailwind CSS

PDF Inverter is a 2025 personal project by Anshit Sinha. PDF Inverter is a lightweight, client-side tool that turns PDFs into dark-mode versions while keeping text as real text. Naive inversion breaks on transparent backgrounds and on rasterized elements. This tool rebuilds each page layer by layer with blend modes instead.

Technologies: JavaScript, pdf-lib, HTML, Tailwind CSS.

Live site: https://anshitsinha.github.io/pdf-inverter/

Source: https://github.com/anshitsinha/pdf-inverter