1.0.11 • Published 2 years ago

encrypt-decrpt-pdf v1.0.11

Weekly downloads
6
License
ISC
Repository
github
Last release
2 years ago

Build Status

Encrypting and Decrypting PDF files with Nodejs

A nodejs library implemented in TS to convieniently encrypt and decrypt pdf documents and save to disk.

Compactibility

VanillaJS, ES5, ES6 and Typescript

Dependecies

Majorly depends on Linux qpdf

Installation

Install qpdf

sudo apt-get install -y qpdf

Install encrypt-decrpt-pdf

npm i encrypt-decrpt-pdf

Using Encrypt-Decrypt-PDF

Intializing in JS

const path = require('path');
const Processor = require('encrypt-decrpt-pdf').PDFProcessor;

const password = 'testpassword';
const username = "testusername";

const processor = new Processor(password, username);

Declaring Parameters

const sourcepath = path.join(__dirname, 'path to file');
const destpath = path.join(__dirname, 'path to file');

const encryptmethod = 'encrypt'
const decryptmethod = 'decrypt'

After initializing, you can use the process method to encrypt/decrypt any PDF file with the correct parameters needed.

Encrypting PDF

processor
  .encrypt(destpath, sourcepath)
  .then(data => console.log(data))
  .catch(err => console.log(err));

DEcrypting PDF

processor
  .decrypt(sourcepath, destpath)
  .then(data => console.log(data))
  .catch(err => console.log(err));

Contributions are very welcome!

1.0.11

2 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago