require 'tempfile' require File.join(File.dirname(__FILE__), '..', 'html', 'html.rb') # Depends on HTMLDOC utility (http://www.easysw.com/htmldoc/) module Markout class Pdf < Formatter def export `cat "#{tempfile.path}" | /opt/local/bin/htmldoc -t pdf \ --bodyfont "Helvetica" --headfootfont "Helvetica" \ --no-compression --color --embedfonts \ --header "" --footer .1. --links --no-title \ --toctitle "" --tocheader "..." --tocfooter "..." \ -` end private def tempfile tempfile = Tempfile.new(File.basename(@document.path) + '.html') tempfile << Markout::Html.new(@document).export end end end