modify-pdf v0.6.1
Table of Contents
Why?
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!
Getting Started
npm
Install the package using the package manager of your choice.
npm install modify-pdfyarn
yarn add modify-pdfpnpm
pnpm 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° rotationDocumentation
Please 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)
- Testing (WIP)
- Examples (WIP)
Troubleshooting
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.
Contributing
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