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

Allow access to PDDocument #19

Open
bshouse opened this issue Aug 16, 2017 · 5 comments
Open

Allow access to PDDocument #19

bshouse opened this issue Aug 16, 2017 · 5 comments

Comments

@bshouse
Copy link

bshouse commented Aug 16, 2017

In order to encrypt or attach files, I believe I need access to the PDDocument.

Would it be possible to add a

PdfLayoutMgr.getPdDocument() {
   return doc;
}
@GlenKPeterson
Copy link
Owner

The reason I didn't allow that was that if you change the state of the PdDocument directly, you could mess things up. What functions/fields do you need to access? Also, what version of PdfLayoutManager are you using? I've been making changes in a branch that may never see production.

@bshouse
Copy link
Author

bshouse commented Aug 17, 2017

I fully understand the need to protect the document so that layout manager can do its job.

For encryption I need to call: PDDocument.protect(StandardProtectionPolicy)
For File attachments: PDDocument.getDocumentCatalog().setNames(PDDocmentNameDictionary)

I am currently using the master branch that I cloned 8 days ago. I suspect 0.5.1.

Thank you for all the great work you have done here! It makes PDFs much easier to create and keep looking nice.

@GlenKPeterson
Copy link
Owner

This is a good idea. Sorry I haven't done it yet. The class PdfLayoutMgr is what currently wraps the PDDocument doc. If you add methods like setStandardProtectionPolicy() and setDocNameDictionary() (or other names you like better) that just call through to the underlying doc, and make minimal changes I'd be willing to merge that into the main branch so it's in future releases. It would be really nice if you made a unit test (in the root of the test package where TestManuallyPdfLayoutMgr sits now) that even prints a one page PDF using the two features you require. If the pdf has to be checked manually, just add some notes on what to look for. Once again, when you change PdfLayoutMgr, try to make absolute minimal changes, make it look like my code, etc. so I can merge it without much fuss.

In any case, if you just add those two methods and you know that they work for you, I can merge them to be in future releases.

@bshouse
Copy link
Author

bshouse commented Aug 26, 2017

I will make it happen.

Thanks again.

@bshouse
Copy link
Author

bshouse commented Aug 27, 2017

The pull request is ready. Please let me know if it doesn't make the grade.

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