Welcome to the LimeSurvey Community Forum

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

PDFreport/limeMpdf - how to change the PDF permissions and metadata?

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

I got PDFreport and limeMpdf installed and I want students to be able to print the PDF that is created, but not allow to copy/modify/fill-out content.

I think this code
Code:
$mpdf->SetProtection(array('print'), '', 'MyPassword');
should do it, but in what file/folder and where in the code would it be best to insert this so updates don't delete it?

Same question for SetAuthor('school name') - probably the same place, but I better ask so it also works in the future :)
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
4 years 8 months ago #196006 by DenisChenu
Make a fork of pdfReport

And try here :
gitlab.com/SondagesPro/ExportAndStats/pd...r/pdfReport.php#L560

$pdfHelper->SetProtection(array('print','modify'), '', 'MyPassword');

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 8 months ago #196030 by Sweden
Thanks, but I'm not sure I understand - I'm not good at php... :unsure:

I tried to insert:

$pdfHelper->SetProtection(array('print','modify'), '', 'MyPassword');

at line 561 in plugins/pdfReport/pdfReport.php, but I get this error:

500: Internal Server Error. Call to undefined method limeMpdf\helper\limeMpdfHelper::SetProtection()
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
4 years 8 months ago #196086 by DenisChenu
Arg , you're right ...

pdfHelper didn't exend mpdf ...


Check somewhere here :
gitlab.com/SondagesPro/coreAndTools/lime...fHelper.php#L173-184

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 8 months ago #196102 by Sweden
Thanks again Denis. Sadly, I don't know how to extend mpdf and googling didn't provide a solution :(

I really need to learn php... does it take a lot of coding to extend mpdf?
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
4 years 8 months ago #196105 by DenisChenu
I didn't say to extend mpdf ...

I say add
Code:
$mpdf->SetProtection(array('print','modify'), '', 'MyPassword');

somewhere here :
gitlab.com/SondagesPro/coreAndTools/lime...fHelper.php#L173-184

It's a quick fix and your broke upgrade of mpdf, but maybe it work.

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.
Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose