Try it: PDF Tools right into the browser
This project is another usage of the gs.wasm that @ochachacha compiled.
It is based on a fork of Laurent Meyer's demo of PDF compression right into the browser.
It provides many tools for PDF manipulation, right into the browser:
- compression/minfication
- merge multiple PDF files into one
- split PDF into individual pages
- extract page ranges
- convert PDF to grayscale
- change page size
It applies ghostscript commands such as:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
Exact command varies based on user input and use case.
The compression is processed in a webworker so that the main thread doesn't become unresponsive and there is virtually no limit to the size of the PDF that you can compress 🎉
To run the project, simply do the following steps
git clone https://github.com/pwasuite/pdftools.git
cd pdftools
npm install
npm run build # static content in dist folder
npm run dev # start vite dev server