Typesafe library for performing simple modifcations of PDF files.
Currently a WIP whilst we work torwards a stable release. PRs welcome.
pdf-lib provides a thorough toolset for manipulation of PDF files within JavaScript environments. This library provides an abstraction over pdf-lib for common tasks such as copying, merging, rotating, inserting and more!
Install the package using the package manager of your choice.
npm install modify-pdfyarn add modify-pdfpnpm install modify-pdfmodify-pdf can then be imported into your app as follows:
import { loadLocalDocument, rotateDocument } from 'modify-pdf';
import { PDFDocument } from 'pdf-lib';
const document: PDFDocument = await loadLocalDocument('example.pdf');
const rotated: PDFDocument = rotateDocument(document, 90); // 90° rotationPlease refer to our documentation page. Alternatively, the documentation can be found at docs/index.md.
This pacakage is still a work in progress. Current status:
- Creating PDFs ✅
- Loading PDFs ✅
- Rotating ✅
- Merging ✅
- Copying ✅
- Metadata ✅
- Inserting (WIP)
- Deleting (WIP)
- Testing (WIP)
- Examples (WIP)
If you are having issues, please check the documentation first and the troubleshooting section there. If that does not help, feel free to open an issue.
We wlecome any and all contributions. Contribution guidelines will be updated soon but in the meantime there are some useful snippets below.
We use yarn as a package manager. Before raising a PR, lint and format the codebase with the following commands:
yarn lint
yarn formatAll tests can be found in ./test/. Tests are run with jest and can be initiated with:
yarn test