Allow plugins to use mPdf to generate PDF document.
Plugin tested on LimeSurvey 3 and 5. Untested on LimeSurvey 6.
- Go to your LimeSurvey Directory
- Clone in plugins/pdfReport directory
git clone https://gitlab.com/SondagesPro/coreAndTools/limeMpdf.git limeMpdf
- Download https://dl.sondages.pro/limeMpdf.zip
- Extract :
unzip pdfReport.zip
- Move the directory to plugins/ directory inside LimeSurvey
A complete documentation using mPdf can be view at Plugin Settings. You can see this documentation at this repository.
$html = "<p>Some HTML to put in your PDF.</p>";
$limeMpdfHelper = new \limeMpdf\helper\limeMpdfHelper();
/* Send pdf file to browser for download */
$limeMpdfHelper->doPdfContent($html);
In constructor you can set the surveyid to be used for Template used in generator.
$limeMpdfHelper = new \limeMpdf\helper\limeMpdfHelper($surveyId);
The twig files used are in ./views/subviews/mpdf/
. Then if this files are in template used : it replace the default twig file from plugin.
If you want to update this file globally : create a new theme based on your desired default theme. In this extended theme directory (upload/survey/yourtheme
), create views/subviews/mpdf
diretory.
Create or copy the file you want to replace in this directory.
Each twig files get this variables : title
,subtiles
and aSurveyInfo
.
body.twig
: the final content of you PDF, the content are insidecontent
variable.head.twig
: the final header set, it‘s empty : no header was set.footer.twig
: the final footer set.stylesheet.twig
: the stylesheet used, by default include- style-bootstrap.twig : bootstrap inspired part
- style-helper.twig : some specific helper (input-text, inner-col ...)
- style-custom.twig : an empty file. It stay empty in this plugin, best place to add your own style.
New tags file specific for limeMpdf must be in views/subviews/mpdf/tags
and muts named as tagname.twig. You arlerady have radio and checknow tag for insipration.
$limeMpdfHelper->setTitle($title,$subtitle=null);
: set the title and the sub title for header.$limeMpdfHelper->setOptions($options = array());
: set specific option for Mpdf. This don‘t reset whole options, just set this in array.
The plugin can work on all 3.X, 2.73, 4.X and 5.X version (without warranty).
- 1.0.0 version was tested on 3.22.25.
- 2.2.0 versin was tested on 5.1.13
- 2.1 : theme : move svg element to tag directly
- 2 : theme : rename svg file :
filename.svg.twig
tofilename.twig
- 1 : 1st stable release
- HomePage http://extensions.sondages.pro/
- Copyright © 2019-2023 Denis Chenu https://sondages.pro
- Include mPDF Copyright © 2010 Ian Back under GPL licence (Credit)
- Licence : GNU Affero General Public License https://www.gnu.org/licenses/agpl-3.0.html
- Donate, Liberapay, OpenCollective
- Issues https://gitlab.com/SondagesPro/mailing/sendMailCron/issues
- Professional support https://support.sondages.pro/