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

Can we add support for password support pdfs? #303

Closed
niksw7 opened this issue Jan 25, 2019 · 6 comments
Closed

Can we add support for password support pdfs? #303

niksw7 opened this issue Jan 25, 2019 · 6 comments

Comments

@niksw7
Copy link
Contributor

niksw7 commented Jan 25, 2019

No description provided.

@vsch
Copy link
Owner

vsch commented Jan 25, 2019

@niksw7, the library provides a very thin wrapper for the OpenHtmlToPDF library, so if what you need is possible with OpenHtmlToPDF then it should be very easy to add.

The whole extension is 50 lines. PdfConverterExtension.java

@niksw7
Copy link
Contributor Author

niksw7 commented Jan 28, 2019

@vsch yes it's possible in openhtmlToPdf.
danfickle/openhtmltopdf#30 (comment)
I created this PR that will add this functionality in flexmark-java.
The feature it will provide along with password encrypted pdf is readOnly pdfs,print-permissions,etc as stated here (https://pdfbox.apache.org/docs/2.0.5/javadocs/org/apache/pdfbox/pdmodel/encryption/AccessPermission.html)
I was debating if I should be adding a new method exportToProtectedPdf or simply overload method of exportToPdf. The latter approach will break for folks using older api.

I have created a PR with the latter approach. Please review and let me know for any feedbacks.
#306

@vsch
Copy link
Owner

vsch commented Jan 28, 2019

@niksw7, thank you very much for taking care of this. I will take a look at the code and provide feedback.

@vsch
Copy link
Owner

vsch commented Jan 28, 2019

@niksw7, I took a look at the code and the only thing that I would change is add an option to hold the PDF protection policy. That way it does not need to be passed separately and only needs to be setup once in options used for parsing/rendering and subsequently re-used for all pdf conversions using these options. The same way it is done for the default text direction.

I will also add overloaded export functions passing null for protection policy so the API remains unbroken for existing code.

Great job. I will make a release shortly.

@vsch
Copy link
Owner

vsch commented Jan 28, 2019

Fix for this is available. Repo updated, maven updated but may take a while to show up in maven central.

@niksw7
Copy link
Contributor Author

niksw7 commented Jan 29, 2019

Great!

@niksw7 niksw7 closed this as completed Jan 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants