Welcome, Guest
Username: Password:
  • Page:
  • 1
  • 2

TOPIC: Customising PDF output

Customising PDF output 9 months 3 weeks ago #122472

  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5914
  • Thank you received: 357
  • Karma: 262
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)limesurvey.org'"
The administrator has disabled public write access.

Customising PDF output 9 months 3 weeks ago #122482

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 8718
  • Thank you received: 1214
  • Karma: 360
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");
The administrator has disabled public write access.

Customising PDF output 9 months 3 weeks ago #122492

  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5914
  • Thank you received: 357
  • Karma: 262
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)limesurvey.org'"
The administrator has disabled public write access.

Customising PDF output 9 months 3 weeks ago #122494

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 8718
  • Thank you received: 1214
  • Karma: 360
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 ..)
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.204 seconds