Quickly create PDFs on the command-line
Clone or download
Latest commit 83d16ac Nov 12, 2013
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
notes Prep publish Aug 4, 2012
src/main Custom resolver for fs css files Aug 6, 2012
.gitignore Initial commit Jul 29, 2012
LICENSE Initial commit Jul 29, 2012
README.md Fixt Phil's typo Nov 12, 2013
build.sbt Note about grid layouts and input stream Aug 6, 2012

README.md

SPDF

This simple utility wraps iText and flying saucer to quickly create PDF's from the commandline.

Installation

cs philcali/spdf

Usage

sdpf -h [file|folder|url...] -i [-o out.pdf]

The url must be in the form of *://*. The specified output file must be in the form of *.pdf*.

The utility was designed to play nice with other CL tools, so input and output can be piped and redirected (in fact, it is encouraged to do so).

cat flyer.html | spdf > out.pdf

curl www.google.com | spdf > google.pdf

lmxml flyer.lmxml | spdf -o out.pdf

Creating Multiple Pages

It's possible to create a multiple page document from a sequence of interspersed files, folders, or URL's by adding them to the var args. For example:

spdf http://google.com /home/philip/flyer.pdf > branding.pdf

spd /my/book > book.pdf

By using the -i flag, you can pipe input files, folders, or URL's from other shell commands. This would be particularly useful if you wanted to control the order of pages. For example:

find ./book | grep ".html$" | spdf cover.html -i > book.pdf

This would first load cover.html, then all of the html files in a directory called book piped to spdf. When run with -i, spdf expects valid inputs to be separated by some kind of whitespace.

Known Issues

  1. Currently, flying saucer will explode trying to paint a grid layout.
  2. The CSS resolver in flying saucer will throw a IOException, if it is given an empty or null, InputStream.

License

Because spdf uses iText for PDF conversion, this application must also be licensed under AGPL.

Read the LICENSE for spdf's copyright.