https://github.com/blahah/pdf-narcissist
Hide a PDF inside a thumbnail of its own first page
https://github.com/blahah/pdf-narcissist
Last synced: over 1 year ago
JSON representation
Hide a PDF inside a thumbnail of its own first page
- Host: GitHub
- URL: https://github.com/blahah/pdf-narcissist
- Owner: blahah
- Created: 2016-04-12T14:31:18.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-12T19:20:33.000Z (over 10 years ago)
- Last Synced: 2025-03-25T20:14:34.800Z (over 1 year ago)
- Language: JavaScript
- Size: 861 KB
- Stars: 50
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## pdf-narcissist
Hide a PDF inside a thumbnail of its own first page.
[](https://github.com/feross/standard)
### How it works
`pdf-narcissist` creates a high definition image of the first page of a PDF using [pdf-to-png](https://github.com/freeman-lab/pdf-to-png). Then it compressess the original PDF with bzip2 (using [compressjs](https://github.com/cscott/compressjs)), and stores the base64 representation of the compressed PDF in the least significant bits of the image using [lsb](https://github.com/hughsk/lsb).
### Usage
#### Command-line
```
$ pdf-narcissist --help
Usage: pdf-narcissist [options] [command]
Commands:
encode encode a PDF into a PNG thumbnail of itself
decode extract a PDF from a PNG
Options:
-h, --help output usage information
-V, --version output the version number
```
```bash
pdf-narcissist encode in.pdf encoded.png
```
```bash
pdf-narcissist decode encoded.png out.pdf
```
#### Library
```js
var narcissist = require('pdf-narcissist')
narcissist.encode('in.pdf', 'encoded.png', function(err) {
// done
})
narcissist.decode('encoded.png', 'out.pdf', function(err) {
// done
})
```
### Installation
For CLI use
```bash
npm install --global pdf-narcissist
```
For library use
```bash
npm install --save pdf-narcissist
```