Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printing PDF file requires password under windows but not under Linux #429

Closed
CaptainChristian opened this issue Jan 8, 2019 · 4 comments

Comments

@CaptainChristian
Copy link

Hi there!
Happy New year everyone!
I call on Spipu/html2pdf in my scripts developed under Linux and it works fine
However when one tries to print such files with a computer under Windows, the file is edited but printing is not permitted without a password
How to suppress such requirement?
Thanks for any help
CaptainChristian

@LittleBigFox
Copy link
Contributor

Hi Christian.
I've never saw such a thing with Html2pdf... Don't you have a .htaccess with file protection?
Regards,
LBF

@CaptainChristian
Copy link
Author

Hi LBF, glad to hear from you again this year!

No I didn't insert any .htaccess anywhere in my codes

However, I've just discovered something which bothers me: SetProtection(array('print'));

$content= ob_get_clean(); //require_once(dirname(__FILE__).'/html2pdf/html2pdf.class.php'); require_once'../dossier/vendor/autoload.php'; use Spipu\Html2Pdf\Html2Pdf; try { $pdf = new HTML2PDF('P','A4','fr'); $pdf->pdf->SetDisplayMode('fullpage'); **$pdf->pdf->SetProtection(array('print'));** $pdf->writeHTML($content); $pdf->Output($nompdf,'D'); } catch(HTML2PDF_exception $e) { echo $e->getMessage(); exit; }

I don't remember why I put it in there..
What do you think?
Regards
CaptainChristian

@LittleBigFox
Copy link
Contributor

Hi Christian!

You're right, it's a TCPDF method, have a look:
https://github.com/spipu/html2pdf/blob/master/doc/tcpdf_methods.md#document-protection

I didn't know about it, but it'll may be clearly usefull, for sure!

Regards,
LBF

@CaptainChristian
Copy link
Author

Thanks LBF for this usefull reminder
Regards
Captainchristian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants