# PDF Utilities & Target-Size Compressor

[![Release](https://img.shields.io/badge/release-v1.0.0-crimson.svg)](https://aloks.com.np/utils/pdf-tools/)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Platform](https://img.shields.io/badge/platform-Web%20%7C%20Client--Side-brightgreen.svg)](https://aloks.com.np/utils/pdf-tools/)

A 100% private, client-side PDF utility suite designed for compressing PDF documents under target file size limits (in KB or MB), merging multiple PDFs, splitting and extracting page ranges, converting Images to PDF, and rendering PDF pages to high-resolution JPEG images.

Made with ❤️ in 🇳🇵 by Alok - [hello@aloks.com.np](mailto:hello@aloks.com.np).

---

## Key Capabilities

- **Target Size PDF Compression**: Downscale image pages and tune quality dynamically to force PDF file sizes strictly under target ceilings (e.g. `< 500 KB`, `< 1 MB`, `< 2 MB`).
- **Merge PDFs**: Combine multiple PDF files into a single consolidated PDF document.
- **Split & Extract Pages**: Extract custom page ranges (e.g. `1-3, 5, 7-9`) or split individual pages into a clean output PDF.
- **Images to PDF**: Convert JPEG, PNG, or WebP photo uploads into a formatted PDF document.
- **PDF to Images**: Render PDF pages into high quality JPEG images packaged in a `.zip` archive.
- **100% Private Client-Side Execution**: All PDF transformations occur locally in browser memory using WebAssembly & HTML5 Canvas. Zero data is uploaded to external servers.

---

## Quick Start

### Online Usage
Access the live hosted utility directly on Alok's Utilities Hub:
[https://aloks.com.np/utils/pdf-tools/](https://aloks.com.np/utils/pdf-tools/)

### Local Development & Testing
1. Clone repository:
   ```bash
   git clone https://github.com/aalooksth/aalooksth.github.io.git
   cd aalooksth.github.io/utils/pdf-tools
   ```
2. Run automated tests:
   ```bash
   node tests/pdf-engine.test.js
   ```

---

## Version History

### v1.0.0 (2026-09-08)
- Initial release of PDF Utilities Suite.
- Implemented target size canvas compression algorithm (`pdf-engine.js`).
- Implemented PDF merge, split/extract, Images &harr; PDF conversions.
- Added Light / System / Dark theme toggle.
- Added automated unit test suite (`tests/pdf-engine.test.js`).

---

## Author & Attribution

Developed and maintained by **Alok Shrestha**.  
Website: [aloks.com.np](https://aloks.com.np) &bull; Email: [hello@aloks.com.np](mailto:hello@aloks.com.np)

*Made with ❤️ in 🇳🇵 by Alok*
