Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Modify styles before queXML export: what classes available ?

  • ulysse68
  • ulysse68's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 3 months ago #122958 by ulysse68
Hi all!

I just discovered the new screen before the queXML export: great! It lets us customize styles, adapting for instance td.questionnaireInfo to left align the text. I tried to define a page-break before a new section:
Code:
span.sectionTitle {font-size:18pt; font-weight:bold; page-break-before:always;}
but the next question becomes blank. I tried to define this property on div.group or h3.grouptitle without success. Apart from the classes indicated in the screen, are there other classes that can be adapted? I couldn't find any list of available styles.

Thanks!
The topic has been locked.
  • adamzammit
  • adamzammit's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
9 years 3 months ago #123061 by adamzammit
Hello!

The classes listed are all those available in the queXML export. For more details you can see the code of the queXML PDF class here: bazaar.launchpad.net/~adamzammit/quexml/.../head:/quexmlpdf.php

queXML PDF uses TCPDF to generate the PDF document. Some CSS styling will work, but not all. Also some (such as this page break CSS) may have unexpected results due to the way the queXML PDF system generates the PDF file.

For a feature like making each section appear on a new page - I'd suggest logging a feature request upstream (here: bugs.launchpad.net/quexml ) and if developed it will wind up in Lime Survey.

Adam
The following user(s) said Thank You: ulysse68
The topic has been locked.
  • ulysse68
  • ulysse68's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 3 months ago #123068 by ulysse68
Thanks Adam! I'll write a feature request for queXML.

Greg
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
9 years 3 months ago #123075 by DenisChenu

adamzammit wrote: ////
queXML PDF uses TCPDF to generate the PDF document. Some CSS styling will work, but not all. Also some (such as this page break CSS) may have unexpected results due to the way the queXML PDF system generates the PDF file.
....

I force page break in tcPDF in a plugin with:
Code:
<br pagebreak="true" />
But using tidy or CHtmlPurifier remove this br.

Then i use some complex system:

Can show code since is not public actually but :
Code:
$oPDF = new pdfReport();
        // Bad hacking to clean HTML code but leave page break
        $pdfSpecific=array('<br pagebreak="true" />','<br pagebreak="true"/>','<br pagebreak="true">','<page>','</page>');
        $pdfReplaced=array('<span>br pagebreak="true"</span>','<span>br pagebreak="true"</span>','<span>br pagebreak="true"</span>','<span>page</span>','<span>/page</span>');
        $sText=str_replace($pdfSpecific, $pdfReplaced, $sText);
        if(function_exists ("tidy_parse_string")) // Call to undefined function tidy_parse_string() in ./application/third_party/tcpdf/include/tcpdf_static.php on line 2099
        { 
            $tidy_options = array (
        'clean' => 1,
        'drop-empty-paras' => 0,
        'drop-proprietary-attributes' => 0,
        'fix-backslash' => 1,
        'hide-comments' => 1,
        'join-styles' => 1,
        'lower-literals' => 1,
        'merge-divs' => 1,
        'merge-spans' => 1,
        'output-xhtml' => 1,
        'word-2000' => 0,
        'wrap' => 0,
        'output-bom' => 0,
        'char-encoding' => 'utf8',
        'input-encoding' => 'utf8',
        'output-encoding' => 'utf8'
      );// Fix UTF8 and <br preakpage="true" />
            $sText=$oPDF->fixHTMLCode($sText,$sCssContent,'',$tidy_options); 
        }
        else
        {
            // TODO : Find the good way to use pagebreak="true", verify i page is used in tcpdf
            // ALT : explode/implode
            $oPurifier = new CHtmlPurifier();
            $oPurifier->options = array(
                'AutoFormat.RemoveEmpty'=>false,
                'Core.NormalizeNewlines'=>false,
                'CSS.AllowTricky'=>true, // Allow display:none; (and other)
                'CSS.Trusted' => true,
                'Attr.EnableID'=>true, // Allow to set id
                'Attr.AllowedFrameTargets'=>array('_blank','_self'),
                'URI.AllowedSchemes'=>array(
                    'http' => true,
                    'https' => true,
                    'mailto' => true,
                    'ftp' => true,
                    'nntp' => true,
                    'news' => true,
                    )
            );
            $sText=$oPurifier->purify($sText);
 
        }
        $sText=str_replace($pdfReplaced, $pdfSpecific, $sText);

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose