Wednesday 26 June 2013

batch pdf maker from command line

Every once and a while i have about 50 pdf files i need to create from a bunch of .html files i have locally on my machine.   Here's a quick and easy way to convert those html files into pdf from the osx command line.

firstly install wkpdf.   Its free.

wkpdf is an open-source software project. Its source code is hosted at For easy installation wkpdf is available as a Ruby gem package from, which means that wkpdf can be easily installed on Mac OS X 10.5.x and later with the RubyGems package manager that comes pre-installed with Mac OS X.

Installing wkpdf requires a recent version of RubyGems. If you don't have installed RubyGems version 1.3.3 or later, you need to update to the latest version with:

sudo gem update --system
Now you are ready to proceed with the installation of wkpdf with the the following command:

sudo gem install wkpdf
After wkpdf has been installed once, you can always update to the latest version with:

gem update wkpdf

for a list of options simply type:
wkpdf --help

but a standard way to use it might look something like this:
wkpdf --source --print-background yes --no-paginate --output sd.pdf

now that you've got wkpdf installed and working here's a simple for-loop command to process any number of .html files in a folder.

type the following into your terminal window after you've navigated to the folder of html files:
for i in *.html; do wkpdf --source "$i" --print-background yes --no-paginate --output $i.pdf; done

and now you have 50 pdf files that are scaled to the size of each html file and you don't have to worry about acrobat or safari and their pagination issues regarding the default 8.5x11 page size.

1 comment:

  1. In addition, slight variations of each machine (e.g., with double jackpots or 5 times play) are all the 카지노 사이트 time being developed. The casino operator can select which EPROM chip to put in in any specific machine decide out} the payout desired. The result's that there's not likely such a thing as a high payback type of machine, since each machine potentially has multiple of} settings. Without revealing the proprietary data, he developed a program that may permit him to determine out} with normally lower than a dozen performs on every machine which EPROM chip was put in. Then he did a survey of over 400 machines in 70 different casinos in Las Vegas. He averaged the info, and assigned a median payback proportion to the machines in every casino.