Adding support for PDF output

In case anyone else needs support for PDF output. 
 - Added a parameter 'format' to allow specifying pdf instead of png
 - Added optional parameters pdfPaperSize and pdfOrientation to control the PDF layout