Skip to content

Hide a PDF inside a thumbnail of its own first page

Notifications You must be signed in to change notification settings

blahah/pdf-narcissist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pdf-narcissist

Hide a PDF inside a thumbnail of its own first page.

js-standard-style

How it works

pdf-narcissist creates a high definition image of the first page of a PDF using pdf-to-png. Then it compressess the original PDF with bzip2 (using compressjs), and stores the base64 representation of the compressed PDF in the least significant bits of the image using lsb.

Usage

Command-line

$ pdf-narcissist --help

Usage: pdf-narcissist [options] [command]


Commands:

  encode <pdf> <png>  encode a PDF into a PNG thumbnail of itself
  decode <png> <pdf>  extract a PDF from a PNG

Options:

  -h, --help     output usage information
  -V, --version  output the version number

pdf-narcissist encode in.pdf encoded.png
pdf-narcissist decode encoded.png out.pdf

Library

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

npm install --global pdf-narcissist

For library use

npm install --save pdf-narcissist

About

Hide a PDF inside a thumbnail of its own first page

Resources

Stars

Watchers

Forks

Packages

No packages published