The extension consists of two php classes and one php script (plus a whole lot of classses that perform the actual html to pff conversion)
This is the main script that generates the PDF file. This is done by calling the original pagegen script and then passing it to the html2pdf conversion script. The generated PDF is then returned to typo3 to be cached for subsequent requests. This script also “fixes” the following issues with the generated HTML:
Sometimes the RTE generates <P> tags within <PRE> tags. They are removed
When using buletted lists the output is theoretically correct but looks quite ugly (the dots are quite a bit above the text line. By changing the alignment of the images to left they look much better.
This class contains the makePdfLink function that is used to generate the link to the PDF file. It takes the current page id and all attached GET parameters and creates a new link using these values. If the simulateStaticPdf option is set these links will be named <alias>.pdf?<additional parameters>. if not they will be called index.php?id=<id>&type=<pdf_type>&<additional parameters>.
This class extends/overrides the core tslib_fe class. Two functions are overridden in typo3 <3.7. In typo3 3.7 and above callbacks are used instead:
checkAlternativeIdMethods
This change will check for a “.pdf” file ending and automatically generate the pageType for the PDF page (default:123)
processOutput
This change will check if a PDF file is currently generated and will add the additionally needed headers then. These include
Content-Type and Content-Dispositionsee Reference for postUserFunc = tx_pdfgenerator2->makePdfLink
Cache-control: private, Connection: Keep-AliveThese are need for Internet Explorer to allow downloading of the file and to avoid IE requesting it twice.
Content-Length: <calculated length>
This is also needed to avoid the need to press Refresh on IE when working with small PDF files.
Additionally the gzip compression is turned off here by setting the ['FE']['compressionlevel'] to ''.