Welcome to the LimeSurvey Community Forum

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

Send response pdf in email

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 5 months ago #191366 by DenisChenu
Replied by DenisChenu on topic Send response pdf in email

rickanderson wrote: …

currently the pdf is done ONLY after survey is submitted



...could the report include a button that called 'doPdfReports()' or have the link I suggested previously (copied from the 'Print your answers.' link)?

I don't know : this need to be developed … and take time …

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 following user(s) said Thank You: rickanderson
The topic has been locked.
More
4 years 5 months ago #191370 by rickanderson
Replied by rickanderson on topic Send response pdf in email
Denis...once again thanks for taking the time to answer my questions.

Just in case this helps you or anyone else.

I tried hard-coding the link into the report (via the survey 'End Message'):

Code:
<a href="/survey/index.php?r=printanswers/view&amp;surveyid=XXXXXX" title="Print" your="" answers.="" class=" ls-print "> Download your PDF. </a>

...and it seems to work - obviously this would be survey specific because of the use of 'surveyid' but pretty sure there will be some way round that.

I added the limeMpdf plugin and it definitely helps with formatting (thank you) but I still haven't been able to get my images to overlay - since it displays fine on screen I am thinking a possible way round this might be to use html2pdf to dynamically generate the required overlaid image from the screen display and use this via mpdf (per its documentation):

Dynamically generated Images

You can define a script which generates an image just as you can in HTML:

<img src="/files/my_file_generating_script.php?color=red" />



Hopefully final question for you Denis is how can I force a landscape orientation for my PDF using pdfReport or limeMpdf?

Cheers...Rick.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 5 months ago #191373 by DenisChenu
Replied by DenisChenu on topic Send response pdf in email

I tried hard-coding the link into the report (via the survey 'End Message'):

Yes : but not after user close his survey : current response id is get by $_SESSION

There are more clear usage : see the global settings for a sample
Code:
<a href="/survey/index.php?r=plugins/direct&amp;plugin=pdfReport&amp;surveyid={SID}&amp;qid={pdf.qid}" title="Print answers" class=" ls-print "> Download your PDF. </a>


else since you use mpdf : you can
- create (via FTP) subviews/mpdf inside your theme directory
- Play with twg file : gitlab.com/SondagesPro/coreAndTools/lime.../views/subviews/mpdf (body.twig i think) to add a pictuire at backround


About landscape : need to hack pdfReport plugin (you can ask a new feature, i can check in february)

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 following user(s) said Thank You: rickanderson
The topic has been locked.
More
4 years 5 months ago #191403 by Indispirit
Replied by Indispirit on topic Send response pdf in email
Thanks for all the info Denis! We'd be very happy to try and hack landscape into pdfReport and share the results.

Could you tell us which file sets the page width for the PDF?
The topic has been locked.
More
4 years 5 months ago #191422 by rickanderson
Replied by rickanderson on topic Send response pdf in email
Hi Denis...

As an alternative (if there is currently no easy way to print landscape using pdfReport/limeMpdf) would it be possible to use the email functionality of pdfReport to send a PDF generated via html2pdf?

Cheers

...Rick.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 5 months ago - 4 years 5 months ago #191434 by DenisChenu
Replied by DenisChenu on topic Send response pdf in email
?????

Really more easy to hack limeMpdf or pdfReport for landscape (*) (one line fix) …
than moving to another pdf producer

And since html2pdf is based on tcpdf … you have same issue …


* i can do it in december with a quote : extensions.sondages.pro/about/contact.html

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.
Last edit: 4 years 5 months ago by DenisChenu.
The topic has been locked.
More
4 years 5 months ago #191474 by rickanderson
Replied by rickanderson on topic Send response pdf in email
Hi All...

Having spent a bit of time trying Denis' plugins 'pdfReport' and 'limeMpdf' (thanks for these and your help throughout the thread Denis) I have not quite been able to achieve what I hoped to do (issues with the resulting PDF report orientation and the inability to overlay images).

I am able to produce the PDF report that I require using 'html2pdf' and would like to re-ask my original question which was whether there is some means within LimeSurvey to attach the resulting PDF file to an email to be sent to an email address supplied via an input box in the survey End Message text (i.e. after the survey has been submitted).

I see 'phpmailer' is listed as a third party plugin - I was wondering whether this be used to do the above and if so, how would I access/reference 'phpmailer' within the survey End Message (or do I have to add php code to one of the theme template files)?

Any suggestions or pointers would be much appreciated.

Cheers...Rick.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #191668 by DenisChenu
Replied by DenisChenu on topic Send response pdf in email
Currently pdfReport allow tcpdf (included in LS core) or LimeMpdf : an extra plugin.

Then seem availbale to create a LimeHtml2pdf plugin and update pdfReport to use it ?

Else , for orientation : adding this hack in LimeMpdf or pdfReport : mpdf.github.io/paging/page-size-orientation.html seems easiest then create a new html2pdf plugin …

Same to add a background image to body : mpdf.github.io/css-stylesheets/supported-css.html
(maybe this one can be done in gitlab.com/SondagesPro/coreAndTools/lime...df/style-custom.twig )

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 following user(s) said Thank You: rickanderson
The topic has been locked.
More
4 years 4 months ago #191674 by rickanderson
Replied by rickanderson on topic Send response pdf in email
Thanks for getting back to me Denis.

I returned to my original solution (as per above reply) using html2pdf.js to create the pdf as required (image overlays and landscape orientation) and tried to work out how to email the resulting client-side data URI string. I think I have now managed to convert the data URI string generated via html2pdf.js to a Blob which I send to a php file using ajax - the php file then uses LimeSurvey's phpmailer to send an email with the resulting PDF attached...still needs a little fine-tuning but seems to be providing all the functionality required.

Happy to go into more detail if anyone stumbles across this thread looking for similar functionality. Although I'm not sure that this the optimal solution as I said it seems to be working for me.

Meantime, thanks for all the help with this and to the team for the LimeSurvey app itself!
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #191692 by DenisChenu
Replied by DenisChenu on topic Send response pdf in email
Oh right … you use a javascript solution with html2pdf … totally unrelated to plugin then :).
I'm sure some people can be interested , maybe in manual / workaround/javascript ?

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 following user(s) said Thank You: rickanderson
The topic has been locked.
More
4 years 4 months ago #191712 by rickanderson
Replied by rickanderson on topic Send response pdf in email
Yes...in the end I returned to the Javascript solution as it was producing the PDF formatting I wanted and all that was missing was the email capability.

Although you suggested that hacking your pdfReport and LimeMpdf plugins should be relatively easy, I wasn't confident enough to start messing around with them and although you said you might be able to look into this at a later date I'm was aware that there might not be any budget to pay you for this work.

As I said, happy to go into more detail if anyone thinks it worthwhile although not sure how robust my solution is (others on here may be able to fine tune or optimise??) ;) Let me know if this might be helpful and how would I go about it. Would be nice to be able to contribute to the project in some small way.
The topic has been locked.
More
4 years 3 months ago - 4 years 3 months ago #192801 by Feorod
Replied by Feorod on topic Send response pdf in email
Hi Denis,

Is it possible to enter more than one email address in the "Send PDF to.." setting of the PDFreport upload question. If so, addresses are separated by comma or semi-colomn ?

Thanx in advance

Eric
Last edit: 4 years 3 months ago by Feorod. Reason: Managed to find the answer to the first question by myself :)
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose