This plugin is not maintained nor updated anymore. Please use the PDFModule as well as the PDFTheme instead.
The TCPDF plugin implements the TCPDF class for generating PDF documents and barcodes.
Please note: This is still a beta version. Please submit pull requests if you have improvements or report issues!
- Download the plugin from github and unzip it.
- Put the content of the
plugins
folder in your Zikulaplugins
folder. - Put the content of the
themes
folder in your Zikulathemes
folder.
Add the {pdfLink tag=true __text='Download as PDF'}
tag to your template. This will generate a link for downloading the current page as PDF file.
Add &theme=pdf
to any link, the page will be outputed as PDF file.
For further parameters and examples please visit https://github.com/cmfcmf/Tcpdf/wiki/Barcodes.
- For 1D codes, add
{barcode1d code='yourCode'}
to your template. - For 2D codes, add
{barcode2d code='yourCode'}
to your template.
Simply add the two following lines of code. This will include the language files and the TCPDF config class:
$tcpdf = PluginUtil::loadPlugin('SystemPlugin_Tcpdf_Plugin');
$pdf = $tcpdf->createPdf(L, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
That will directly return a new TCPDF()
object. Below you see the arguments passed to the createPdf()
method:
/**
* Creates a new PDF file.
*
* @param $orientation (string) page orientation.
* @param $unit (string) User measure unit.
* @param $format (mixed) The format used for pages.
* @param $unicode (boolean) TRUE means that the input text is unicode (default = true)
* @param $encoding (string) Charset encoding; default is UTF-8.
* @param $diskcache (boolean) If TRUE reduce the RAM memory usage by caching temporary data on filesystem (slower).
* @param $pdfa (boolean) If TRUE set the document to PDF/A mode.
*
* @param $langcode (string) The language to use in the PDF. (default = system language)
*
* @return new TCPDF()
*
* @note The first seven parameters are inherited from TCPDF.
*/
For further documentation visit the TCPDF documentation.
If you'd like to use an external configuration file, simply place it in:
modules/Foo/lib/vendor/tcpdf_foo_config.php
(Zikula <= 1.3.6)modules/Foo/vendor/tcpdf_foo_config.php
(Zikula >= 1.3.7)
Only define values in there, which are different from the original config file.
Example: If you'd like to change the PDF_FONT_SIZE_MAIN
and PDF_MARGIN_TOP
, your config file should look like this:
/**
* custom top margin
*/
define ('PDF_MARGIN_TOP', 5);
/**
* custom main font size
*/
define ('PDF_FONT_SIZE_MAIN', 30);
?>
Please note: I chose the location looking at the News module. If you think there could be a better place or naming, please open an issue / make a pull request!
Pull requests and issue-reportings are most welcome!
GNU/GPLv3 (or at your option, any later version).
Important: This project contains the TCPDF project which is licensed under GNU/LGPLv3. You find the files under plugins/Tcpdf/lib/vendor/tcpdf