Welcome to the LimeSurvey Community Forum

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

PDFreport - where is the stylesheet for this plugin?

  • Sweden
  • Sweden's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 9 months ago #194813 by Sweden
Hi there,

What stylesheet does the PDFreport plugin use? I thought it was either the base.css or pdfreport.css file, but they don't seem to have any effect on the PDF's. I tried to move the pdfreport.css to several different locations, but I guess I haven't found the right place… help section on GitHub says it should be moved to "the files directory of the template", but I'm not sure where that is.

So my questions are:
  1. What stylesheet does this plugin use as default?
  2. Where should I put the pdfreport.css?

LS version is 3.22.7+200225
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 9 months ago - 4 years 9 months ago #194817 by Joffm

"the files directory of the template", but I'm not sure where that is.

upload/themes/survey/[theme_name]/files

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 4 years 9 months ago by Joffm.
The following user(s) said Thank You: Sweden
The topic has been locked.
  • Sweden
  • Sweden's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 9 months ago #194822 by Sweden
Thanks, but it doesn't seem to change anything when I place the pdfreport.css file there (neither in the 20+ other folders I have tried). Very strange. I wonder if I have to rename it or something else? :unsure:
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 9 months ago - 4 years 9 months ago #194823 by Joffm
Obviously you do something wrong that I can't see.
You don't have to change anything, only copy.

Two examples with different bg-color of the table cell <td>

1. example
Code:
.tdanswer {
  font-size:11pt;
  background-color: red;
  color:black;
/*  font-weight:bold;*/
  border: 1px solid black;
}



2. example
Code:
.tdanswer {
  font-size:11pt;
  background-color: navy;
  color:yellow;
/*  font-weight:bold;*/
  border: 1px solid black;
}


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 4 years 9 months ago by Joffm.
The following user(s) said Thank You: DenisChenu, Sweden
The topic has been locked.
  • Sweden
  • Sweden's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 9 months ago - 4 years 9 months ago #194829 by Sweden
Thanks again for you help. I tried to change font size for h1, h2, h3 etc. (I use them on the page that is converted into PDF) Also changed background color and font size for body. None of these changes can be seen in the PDF…

Strange thing is that I changed the background color in divs in pdfreport.css and that worked! Not sure why the other changes aren't showing. I will have to play with that some more.

BTW: Do you know how to change the header in the template that pdfreport uses, e.g. change font size for the sub title for the pdf (default is {surveyname} and is inserted in the top left corner). It could also be nice to be able to insert some text in the footer, next to the page numbers.
Last edit: 4 years 9 months ago by Sweden.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
4 years 9 months ago #194839 by DenisChenu
PDFReport have 2 different system to generate PDF

The included tcpdf : using pdfreport.css in template/files directory
limeMpdf where you can update m a lot more things : gitlab.com/SondagesPro/coreAndTools/limeMpdf#adapt-html-and-css and have an adapted boostrap style.

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 following user(s) said Thank You: Sweden
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 9 months ago #194841 by Joffm
One more word:

As you see here in the "pdfReport.php"
Code:
private function _getCss()
    {
        $oTemplate = \Template::model()->getInstance(null, $this->_iSurveyId);
        if (is_file($oTemplate->filesPath.'pdfreport.css')) {
            /* @todo : get parent */
            return file_get_contents($oTemplate->filesPath.'/pdfreport.css');
        }
        return file_get_contents(dirname(__FILE__).'/pdfreport.css');
    }

the css is taken per default from the plugin's pdfreport.css
But as it is always preferable to design the report similar to the theme you can use the folder of the theme (what I prefer).

And since this report is based on TCPDF resp. mPDF, you should read the documentation there and study some examples of TCPDF.
Furthermore you might get help in the "pdf.php" (in "application/libraries/admin")

And as Denis said, try to use "limeMpdf". But I am not fasmiliar with it.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu, Sweden
The topic has been locked.
  • Sweden
  • Sweden's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 9 months ago - 4 years 9 months ago #194896 by Sweden
Many thanks to both of you ;) I'm trying to figure out how the default pdfreport plugin works so I haven't looked into limeMpdf.

I have, however, tried for many hours to find out how I can insert some text centered in the footer of the PDF (below the line where the page numbers are). I have looked through many different files, but I just can't figure out what creates the line in header/footer and the word "page" in the footer.

Anyone know where I can insert some text so it shows in the footer of the PDF?
Last edit: 4 years 9 months ago by Sweden.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
4 years 9 months ago #194906 by DenisChenu
Please : show a screenshot of your question setings.

To add any text inside the footer : you need limeMpdf

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 following user(s) said Thank You: Sweden
The topic has been locked.
  • Sweden
  • Sweden's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 9 months ago #194959 by Sweden
Thanks again. PDFreport is working fine so that is not the problem. I may have to look into limeMpdf, but I was hoping that there was a shortcut to inserting just a few words in the footer (perhaps by editing the code directly?)

I'm not sure if I can ask more questions in this thread, but how can I prevent a page-break in the middle of a div or a table? Content is dynamic. I have tried a couple of things (nobr="true", page-break-inside:avoid), but that doesn't work.

Also, how can I prevent the warning message "Are you sure you want to leave this page?" (something like that) that shows when you click the "print answers" link (that are used for downloading the PDF). I don't want to disable this message completely on the last page, because it is very useful. It is only when people are clicking the link to download their PDF that it shouldn't show (because it will only confuse people since they are not leaving the page).
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
4 years 9 months ago #195037 by DenisChenu
About footer : in TCPDF it's done by LimeSurvey core, you can hack LimeSUrvey.
In limeMpdf : it's done with gitlab.com/SondagesPro/coreAndTools/lime...ews/mpdf/footer.twig file. Then : you can "just" don it in your template.

About pagebreak : i already tested page-break-inside:avoid its work, but not perfect .
It's the reason why i add it only for textarea part. When there are multiple it must broke somewhere , then broke .... never at the good place.

About forced pagebreak : gitlab.com/SondagesPro/ExportAndStats/pd...r/pdfReport.php#L541



> Also, how can I prevent the warning message "Are you sure you want to leave this page?"
Not come from the plugin or LimeSUrvey : never see this.

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 following user(s) said Thank You: Sweden
The topic has been locked.
  • Sweden
  • Sweden's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 9 months ago - 4 years 9 months ago #195095 by Sweden
Thanks a lot :) and sorry for my late response.

I'm not sure what LS file I should change so the footer changes, but I will try and figure it out. I will also take a closer look at pagebreak and how to use it best - thanks for that too.
Last edit: 4 years 9 months ago by Sweden.
The topic has been locked.
Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose