In-Portal has nice kPDFHelper class, that allows to generate PDF document based on given template name. It only has limitation, that it always uses A4 as page size for created document. And there is no ability to change that format from inside of HTML.

Here is patch, that allows to change page size using @page { size: width height orientation; } which is complain to CSS2 specifications. You can set page size and orientation or one of them.