Skip to content

Commit

Permalink
Trying to improve the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
vbuch committed Jun 28, 2019
1 parent 4503cf2 commit 5b617fc
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,23 @@ The purpose of this package is not as much to be used as a dependendency, althou

## Usage

### With PdfKit
Install with `npm i -S node-signpdf node-forge`.

Simply said this could be used in two steps. `install` and `sign`.
In practice we expect that most people will just read through the code we've written in the testing part of this package and figure it out themselves. If that's your case, you should read the [[Signing PDF in simple steps]](#signing-pdf-in-simple-steps) section.

Install with `npm i -S node-signpdf node-forge`.
### With pdfkit-created document

Call `.sign()`
You have already created a PDF using foliojs/pdfkit and you want to sign that. Here's how this becomes possible:

```javascript
import signer from 'node-signpdf';
Before saving your file, you need to a add a signature placehoolder to it. We have a helper for that.

const signedPdf = signer.sign(
fs.readFileSync(PATH_TO_PDF_FILE)
fs.readFileSync(PATH_TO_P12_CERTIFICATE),
);
```
Once you have the placeholder, just [sign the document].

In practice we expect that most people will just read through the code we've written in the testing part of this package and figure it out themselves. If that's your case, you should read the [[Signing PDF in simple steps]](#signing-pdf-in-simple-steps) section.
### With any PDF document

Yes. This is new since version 1.0. We have a helper that can add a signature placeholder in at least the most basic PDFs without depending on pdfkit.

Once you have the placeholder, just [sign the document].

## Notes

Expand Down

0 comments on commit 5b617fc

Please sign in to comment.