[misc] Fixed issue with exporting documents with pdftemplate:
* allowed using $cdoc in the pdfheader and pdffooter in the template to access the document being exported (like in the standard single page export)
* fixed the rendering of header and footer from the template for the fake wrapping document, where html macros were being rendered