Skip to content

Latest commit

 

History

History
71 lines (48 loc) · 1.78 KB

README.md

File metadata and controls

71 lines (48 loc) · 1.78 KB

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.