skip to Main Content

Change Limesurvey PDF Reports – How to have Data and Charts on the same single Pages

Limesurvey is the number one solution for complex and easy to use online surveys. it has great functionality, awesome potential and a huge and supportive community. Though the system is growing fast in regards of its capabilities there still is a major annoying flaw: The PDF-Reports

Too much white space – Limesurvey PDF-Reports are wasting paper

It is pretty easy and common in limesurvey to have  a pdf-report generated for just a few questions that enormeously exceeds the amout of space really necessary to plot all information. These reports only have improved very little over time and are not very handy at all. Who wants to gasp hundreds of pages just to get the informaiton needed if it could be put together much more convenient? If you enable graphs it at least wil generate two pages for each question – one for the data table itself and one for the chart. Both pages usually are just fileld for at maximum one third of the available space. So why not put the chart onto the same page as the data?

Hacking the Limesurvey PDF-Generator

If have scoured the limesurvey forums but had no luck. Though there many questions regarding the quality and convenience of the reports no feasible answer was given and no solution in sight. So, I had to come up with my own. And, believe it or not. It works. But it requires modificaiton of a core file. But dont let that turn you down. The effect ios awesome and it is easy to achieve.

Open the following file – located in the limesurvey installaton foelder on your server

Open: application/helpers/admin/statistics_helper.php

So actually what we want to implement is to remove the pagebreak prior to each chart being generated. So we first find the part where the charts are created. Most importantly the „PCHARTS“. So at first find a string like this:

//-------------------------- PCHART OUTPUT ----------------------------

Then scour down below and search for sth like this:

case 'pdf':

             $this->pdf->AddPage('P', 'A4');

             $this->pdf->titleintopdf('Visuelle '.$pdfTitle, $titleDesc);

As you can easily quess that this simply does the following:

When processing charts (since we are in the charts section) and if we want to create a pdf (case PDF)

  • Add a Page //AddPage(…)
  • Add a Linebreak //Ln();
  • Add the title //titleintopdf(…)

So we simply have to adapt this part to our needs to remove the unwanted pagebreaks before each generated graph. Change the part to something that looks like this:

case 'pdf':

             //$this->pdf->AddPage('P', 'A4'); //no pagebreak


            //$this->pdf->titleintopdf('Visuelle '.$pdfTitle, $titleDesc); //no title

When generating your PDF-Reports now they finally should look like shown in the example above. But keep in mind: whenever you do an update that affects this file, you will loose your changes!

Back To Top