-
Notifications
You must be signed in to change notification settings - Fork 24
plessl edited this page Aug 16, 2010
·
5 revisions
The installation of the plessl-wkpdf RubyGem fails or gem does not show the latest version of plessl-wkpdf
The plessl-wkpdf gem requires a recent version of RubyGems. You can update your RubyGems installation using:
sudo gem update --system
How can I mirror a whole website and create one PDF file for each HTML page?
wkpdf intentionally does not support mirroring or batch converting on its own, because there are excellent tools that can do this job, for example wget. It is fairly easy to write a skript that leverages wget and converts all mirrored files. The following script gives you an idea how this can be done:
#!/usr/bin/ruby
URL = 'http://www.example.com'
system("wget -E --mirror #{URL}")
BASE_DIR = URL
files = `find #{BASE_DIR} -name '*.html'` files.each { |source_file| source_file.chomp! dest_file = source_file.sub(/(.*)\.html?/, '\1.pdf') system("wkpdf --source #{source_file} --output #{dest_file} --format A5")