Code Monkey home page Code Monkey logo

pdfdir's Introduction

pdfdir

Turns a directory tree of PDFs into a single bookmarked PDF. Automatically handles the table of contents.

Tested on Linux and Mac.

Usage

If you arrange your PDF files in folders like this:

book/01-Table of Contents.pdf
book/02-First Generation/01-Mary Cunningham.pdf
book/02-First Generation/02-Peter Cunningham.pdf
book/02-First Generation/02-:more-notes.pdf
book/03-Second Generation/01-John Mendell Cunningham.pdf
book/99-Index.pdf

and run:

$ pdfdir-join book

you will find the result in "book.pdf"

The PDF's table of contents will be automatically generated from the filenames:

Table of Contents
First Generation
  Mary Cunningham
  Peter Cunningham
Second Generation
  John Mendell Cunningham
Index

The 01-, 02- prefixes determine the order of the chapters in the final book and don't appear in the bookmarks.

If you don't want a file to be added to the TOC, adding a : to the beginning of its filename will suppress it (02-:more-notes.pdf above).

Prerequisites

MacOS: brew install ghostscript Linux: apt-get install ghostscript

And also Ruby. Hopefully this is temporary.

Verify PDFs

This package also includes some tools to help assemble the input files. This will find corrupt PDFs:

$ pdfdir-verify book

It uses Ghostscript to carefully process every page of every PDF file. This is awfully slow. You can specify --quick for a 10X speedup at the risk of missing some obscure corruptions.

Re-encode PDFs

If you're having trouble with encrypted or corrupt PDFs, try using pdfdir-copy to duplicate your entire directory structure. It takes a while but, because it re-encodes each PDF, the result is sure to be valid.

$ pdfdir-copy book /tmp/book-fixed

pdfdir's People

Contributors

bronson avatar troyp avatar

Stargazers

Tiago avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.