@toolpal/pdf-toolkit
publicv2.0published 1 download this weekMIT
Local offline PDF toolkit with zero network access and no API key: inspect pages and metadata, merge multiple PDFs, split or extract page ranges, rotate pages, stamp text watermarks, extract embedded text page by page, and edit or strip document metadata.
# @toolpal/pdf-toolkit
An all-in-one local PDF toolkit — **100% offline (`net: false`) with zero API keys**. Inspect, merge, split, rotate, watermark, extract text, and edit or scrub metadata on your own machine without uploading private documents to online converters.
## Actions
| Action | Description |
|---|---|
| `inspect` | Returns page count, per-page dimensions and rotation, file size, and document metadata |
| `merge` | Combines 2–50 PDFs (`files`) into a single PDF |
| `split` | Extracts a page selection (`pages`, e.g. `"1-3, 5, 8-end"`) into one PDF, or splits every `splitEvery` pages into separate PDFs |
| `rotate` | Rotates all pages or a selected `pages` range by `90`, `180`, or `270` degrees |
| `watermark` | Stamps a diagonal, header, or footer text watermark onto selected or all pages |
| `extract_text` | Extracts embedded text page by page and writes a `.txt` output file |
| `set_metadata` | Updates title/author/subject/keywords, or strips all metadata with `clearMetadata: true` |
## Examples
### Merge PDFs
```json
{
"action": "merge",
"files": ["cover.pdf", "body.pdf", "appendix.pdf"],
"filename": "complete-packet"
}
```
### Watermark a draft
```json
{
"action": "watermark",
"file": "proposal.pdf",
"watermark": "CONFIDENTIAL DRAFT",
"position": "diagonal",
"opacity": 0.2
}
```
### Extract specific pages
```json
{
"action": "split",
"file": "annual-report.pdf",
"pages": "1-3, 12-15"
}
```
## Notes
- Runs 100% offline (`net: false`, no environment variables).
- Text extraction reads embedded PDF text layers (for scanned image-only PDFs, use OCR such as `@toolpal/doc-extract`).
- Maximum file size: 50 MB per input PDF (100 MB total for `merge`).