Welcome to the LimeSurvey Community Forum

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

PDF-Export of Answer-page via javascript

  • Kalle2015
  • Kalle2015's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 1 month ago #117619 by Kalle2015
PDF-Export of Answer-page via javascript was created by Kalle2015
Hello everyone,

I was trying to set up a "PDF Print" Button, to enable participants to print out the shown answers. I used jsPDF, which finally worked quite well. jsPDF takes the HTML and some CSS style-information and creates a simple PDF file. Problem is the style-options are rather basic, color-information are lost for example.

Does anyone have any experiences in setting up a jsPDF PDF-Export in lime?
Any other suggestions, how this could be realised?

Thanks a lot!
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 1 month ago #117625 by DenisChenu
Replied by DenisChenu on topic PDF-Export of Answer-page via javascript
Hi,

I use "print page" for this. Think it's better.

It's not linked with LimeSUrvey, but seems jsPDF has own system for color/style. In the example:

doc.setTextColor(100);
doc.text(20, 20, 'This is gray.');

Maybe you can try with :
Code:
var doc = new jsPDF();
 
// We'll make our own renderer to skip this editor
var specialElementHandlers = {
  '#editor': function(element, renderer){
    return true;
  }
};
 
// All units are in the set measurement for the document
// This can be changed to "pt" (points), "mm" (Default), "cm", "in"
doc.fromHTML($('#render_me').get(0), 15, 15, {
  'width': 170, 
  'elementHandlers': specialElementHandlers
});

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
More
6 years 1 month ago #164599 by Robert1973
Replied by Robert1973 on topic PDF-Export of Answer-page via javascript
Hi Kalle2015, I'm interested how you got this to work. Would you like to share your code and the steps you took?

Many thanks in advance,
Robert
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose