Skip to content

Typesafe library for making simple modifications to PDFs. Current work in progress towards a stable release.

Notifications You must be signed in to change notification settings

jrobsontull/modify-pdf

Repository files navigation

modify-pdf

Typesafe library for performing simple modifcations of PDF files.

Currently a WIP whilst we work torwards a stable release. PRs welcome.

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-pdf

yarn

yarn add modify-pdf

pnpm

pnpm install modify-pdf

modify-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° rotation

Documentation

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)
  • Deleting (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 format

All tests can be found in ./test/. Tests are run with jest and can be initiated with:

yarn test

About

Typesafe library for making simple modifications to PDFs. Current work in progress towards a stable release.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published