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

More
6 months 17 hours 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
$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 :)

Please Log in to join the conversation.

LimeSurvey Partners
More
6 months 16 hours 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 service on demand , plugin development . I don't answer to private message.
The following user(s) said Thank You: Sweden

Please Log in to join the conversation.

More
6 months 12 hours 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()

Please Log in to join the conversation.

More
5 months 4 weeks 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 service on demand , plugin development . I don't answer to private message.
The following user(s) said Thank You: Sweden

Please Log in to join the conversation.

More
6 months 5 hours 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?

Please Log in to join the conversation.

More
5 months 4 weeks ago #196105 by DenisChenu
I didn't say to extend mpdf ...

I say add
$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 service on demand , plugin development . I don't answer to private message.
The following user(s) said Thank You: Sweden

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now