# insgen

> PDF Annotation Tools

Latest version **1.0.12** (published 2023-09-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install insgen
pnpm add insgen
yarn add insgen
bun add insgen
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.12 |
| Published | 2023-09-07 |
| First published | 2023-08-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | prateek1071 |
| Keywords | PDF, Annotations,  Node.js, pdf-lib, yargs, Text processing, PDF editing, Acrobat-Reader |

## Links

- npm: https://www.npmjs.com/package/insgen
- Repository: https://github.com/Prateek-Kaizoku/PDFTextCommentExtarctionCLI
- Homepage: https://github.com/Prateek-Kaizoku/PDFTextCommentExtarctionCLI#readme
- Issues: https://github.com/Prateek-Kaizoku/PDFTextCommentExtarctionCLI/issues
- npm.io page: https://npm.io/package/insgen

## Dependencies (4)

- [fs](https://npm.io/package/fs.md) ^0.0.1-security
- [yargs](https://npm.io/package/yargs.md) ^17.7.2
- [pdf-lib](https://npm.io/package/pdf-lib.md) ^1.17.1
- [pdfjs-dist](https://npm.io/package/pdfjs-dist.md) ^3.9.179

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 1.0.12 (latest) — 2023-09-07
- 1.0.11 — 2023-09-07
- 1.0.10 — 2023-08-21
- 1.0.9 — 2023-08-21
- 1.0.8 — 2023-08-21
- 1.0.7 — 2023-08-20
- 1.0.6 — 2023-08-20
- 1.0.5 — 2023-08-20
- 1.0.4 — 2023-08-20
- 1.0.3 — 2023-08-20
- 1.0.2 — 2023-08-19
- 1.0.1 — 2023-08-19
- 1.0.0 — 2023-08-19

## README

PDF Annotation Tools

This repository contains two scripts that allow you to work with PDF annotations: one for extracting annotations from a PDF file and saving them to a text file, and another for embedding text annotations into a PDF file using coordinates and annotations text from a provided text file.

Prerequisites

Before using these scripts, ensure you have the following prerequisites:

Node.js installed on your machine
Installation

To install the required dependencies, follow these steps:

Clone or download this repository to your local machine.
Open a terminal and navigate to the downloaded repository's directory.
Install the required dependencies using npm:
plaintext
Copy code
npm install
This will install the necessary packages, including pdfjs-dist, yargs, and pdf-lib.
Script 1: PDF Annotation Extractor

Usage
To extract annotations from a PDF file and save them to a text file, follow these steps:

Make sure you have completed the installation steps mentioned above.
Run the script using Node.js with the following command:
plaintext

```js
node extract_pdf_annotations.js <path_to_pdf> <output_txt_file>

```

Replace <path_to_pdf> with the path to the PDF file you want to extract annotations from, and <output_txt_file> with the desired path for the output text file.
For example:
plaintext
Copy code

```js
node extract_pdf_annotations.js input.pdf output_annotations.txt
```

The annotations will be extracted and saved to the specified output text file. You will see a confirmation message once the process is complete.
Script 2: PDF Annotations Embedder

Usage
To embed text annotations into a PDF file using coordinates and annotations text from a provided text file, follow these steps:

Make sure you have completed the installation steps mentioned above.
Run the script using Node.js with the following command:
plaintext
Copy code

```js

node embed_annotations.js <pdf_path> <annotations_txt_path> <output_pdf_path>
```

Replace <pdf_path> with the path to the PDF file you want to embed annotations into, <annotations_txt_path> with the path to the annotations text file, and <output_pdf_path> with the desired path for the output PDF file.
For example:
plaintext
Copy code

```js
node embed_annotations.js input.pdf annotations.txt output_annotated.pdf

```

The script will process each line in the annotations text file, where each line specifies the page number, x-coordinate, y-coordinate, and annotation text. Annotations will be embedded into the specified PDF file at the specified coordinates on the respective pages.
The modified PDF with embedded annotations will be saved as the output PDF file. You will see a confirmation message once the process is complete.
Notes

Both scripts are provided as-is under the ISC License. Feel free to use, modify, and distribute them as needed.

---
_Source: https://npm.io/package/insgen · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
