htmtToPDF is only for MODx Evolution (currently up to 1.5)
This MODx snippets uses TCPDF, available at
http://www.tcpdf.org/, to create the PDF Files from the content of a web document, published with MODx. TCPDF is part of the package.
The main goal is to create highly configurable PDF documents. This is possible with a lot of parameters, that one can use on a call and the usage of chunks. All chunks make use of the placeholders as defined in other MODx snippets.
The project is hosted on GitHub, you will find everything on the project page at
https://github.com/sjstoelting/MODx-htmlToPDF.
Downloads are available at GitHub on
https://github.com/sjstoelting/MODx-htmlToPDF/downloads.
Installation instructions for htmlToPDF
The TCPDF files are part of this package.
Upload all files inside the assets folder to your web-space. The lib folder already contains a htacces file, that disallows every call from the web.
If you don’t want to use the default path used for TCPDF and htmlToPDF, that is not a problem, but you need to configure the snippet with the path informations,
or give the path informations with the snippet call.
If you want a logo in the page header, you have to upload the logo the folder assets/lib/tcpdf/images/. This is because TCPDF only uses this folder, to
look images files.
Create two new snippets:
htmlToPDF -> assets/snippets/htmlToPDF/snippet.htmlToPDF.php.tpl
getCurrentDocID -> assets/snippets/htmlToPDF/snippet.getCurrentDocID.php.tpl
Create the PDF output path and give the rights, to create and delete files there (777). The default is assets/pdf/, but you may configure it to fit your
needs.
No create the chunks, that you want to use in your snippet calls. You may create different chunks for different websites, if you use htmlToPDF in different
templates.
Open the templates, where you want to use htmlToPDF and add the call to the chunk at the top of the template. Here is an example of a call:
[!htmlToPDF? &author=`Stefanie Janine Stoelting` &tvKeywords=`documentTags` &headerLogo=`logo.png` &chunkContentFooter=`pdf-contentfooter` &chunkStandardHeader=`pdf-header-text` &chunkStyle=`pdf-style`!]
For further information about the snippet parameters read the documentation in parameter-descriptions.html, that is part of the package or visit the project site on GitHub at
https://github.com/sjstoelting/MODx-htmlToPDF.
The file assets/snippets/htmlToPDF/chuncks/pdf-link.txt contains a chunk to generate a link for the PDF download. If you place the call outside the content, the link to the PDF call is not part of the PDF document.