Check out the LimeSurvey source code on GitHub!

Customising PDF output

More
1 year 7 months ago #122472 by Mazi
Anyway, why do you try to wrap this into a PDF by using an external tool if most browsers can print to PDF?


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
1 year 7 months ago #122482 by DenisChenu
Hi
Yii::import('application.libraries.admin.pdf', true);
    Yii::import('application.helpers.pdfHelper');
 
    $aPdfLanguageSettings=pdfHelper::getPdfLanguageSettings(Yii::app()->lang->langcode);
    $aSurvey=getSurveyInfo($this->iSurveyId,Yii::app()->lang->langcode);
    define('K_PATH_IMAGES', getTemplatePath($aSurvey['template']).DIRECTORY_SEPARATOR);
 
    $sSurveyName = $aSurvey['surveyls_title'];
    $sHeader=Yii::app()->getConfig('sitename');
    $sSubHeader = $sSurveyName;
 
    $oPDF = new pdf();
    $sText = functionCallToProduceContent();
    $sCssContent=functionCallToProduceCss();
    $sText="<style>\n{$sCssContent}\n</style>\n$sText\n";
    $oPDF->initAnswerPDF($aSurvey, $aPdfLanguageSettings, $sHeader, $sSubHeader);
    // output the HTML content
    $oPDF->writeHTML($sText, true, false, true, false, '');
    $oPDF->lastPage();
 
    header("Pragma: public");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    $sExportFileName = sanitize_filename($sSurveyName);
    $oPDF->Output($sExportFileName."-".$this->iSurveyId.".pdf","D");

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

More
1 year 7 months ago #122492 by Mazi
Denis, can you provide some more documentation and details related to this code?!


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
1 year 7 months ago #122494 by DenisChenu
This code produce a PDF file with:
HTML content from functionCallToProduceContent (for example : a question text, the "full response table etc ..)
With CSS style from functionCallToProduceCss

Need $this->iSurveyId

Is part of code i use for "own PDF export", replacing the default link with my own link (but in JS .... sh*t ..)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

More
7 months 1 week ago #139263 by Moonlight7

coeneisma wrote: As I need a custom pdf-export on short notice I just hired a programming friend. When finished i'll ask him to give a short how-to.


@coeneisma, it has been a year since, any update on this please ?

Please Log in to join the conversation.

More
7 months 1 week ago #139275 by DenisChenu
framagit.org/SondagePro-LimeSurvey-plugin/sendPdfReport

With beforeControllerAction : manual.limesurvey.org/BeforeControllerAction

We can surely do own system for public user and send directly the pdf.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

More
7 months 1 week ago #139287 by Moonlight7

DenisChenu wrote: framagit.org/SondagePro-LimeSurvey-plugin/sendPdfReport

With beforeControllerAction : manual.limesurvey.org/BeforeControllerAction

We can surely do own system for public user and send directly the pdf.


Thanks so much Denis.
I most importantly want to be able to, as admin, access a well presented clean version of a custom report for each individual response be it in pdf, html, or Word doc.

If I understood correctly, your sendPdfReport allows me to send any particular question content in a pdf file to the survey admin. This would be a great one way for me to access a summary report type question of each response if I couldn't find another way.

I did install the above plugin and enabled it in plugin manager and filled in the emails and the code of the summary report question and tested the survey after activating it on a local server (in Online Mode) but I've had no luck yet in receiving any pdf emailed neither could I find a copy of the pdf saved on server in the dedicated directory I created at limesurvey/sendPdfReports .

Do I understand what the plugin does correctly ? if yes, then what I might be doing wrong so I don't get any pdf generated/ sent ?!

Many thanks

Please Log in to join the conversation.

More
7 months 6 days ago #139294 by DenisChenu
Plugin done with Version 2.06+ Build 151205, there are no reason for 'not working' after, but in case : always activate debug mode.

Example of config usage:

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
Attachments:
The following user(s) said Thank You: Moonlight7

Please Log in to join the conversation.

More
7 months 6 days ago #139307 by Moonlight7
Thanks so much Denis
I'd made the mistake of adding brackets to the question code and that was what's preventing it generating the files it seems. The email thing still not working though but I'm not stressed about this now and I think it's a local server settings thing maybe.

I am still relatively new to LS but having understood how EM works and getting more comfortable using it and creating a custom summary report type of question and finally using your wonderful plugin to get a copy of the summary, saved me the headache of trying to find another solution and the frustration of having to give up LS. I'm so glad I don't have to anymore now.

What I need your kind input on now is:
1- How can I make the pdf file name have certain question code in it ? e.g. name.pdf . I tried putting {name} in the naming fields on the plugin configuration page but the { } get stripped off and the code fail to be processed and I onlly get e.g. name_311214.pdf as a file name !

2- Where can I modify the pdf style/ formatting ? which file/s I need to work on if I cannot set a special template css for it maybe ?

3- Would it be a big headache making the plugin create an editable html or Word version of the files or would that need a separate plugin ?

I'm really grateful for your kind help

Please Log in to join the conversation.

More
7 months 6 days ago #139325 by DenisChenu
1: not done actually, PHP file must be updated
2 : framagit.org/SondagePro-LimeSurvey-plugi...ndPdfReport.php#L338 then you can use some css in framagit.org/SondagePro-LimeSurvey-plugi...blob/master/base.css . But you can use included style if needed too.
3 : must extend another Class , and replace this function : framagit.org/SondagePro-LimeSurvey-plugi...ndPdfReport.php#L316

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
The following user(s) said Thank You: Moonlight7

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form