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

Make Document and PdfWriter compatible with try-with-resources #165

Merged
merged 1 commit into from
Mar 26, 2019

Conversation

wiktor-k
Copy link
Contributor

Hello! 👋

This change makes Document and PdfWriter implement AutoCloseable interface either directly or indirectly. PdfWriter was made implement Closeable as Closeable is an I/O interface and PdfWriter already deals with I/O. This is similar to what PdfReader already does.

Document on the other hand doesn't do I/O so it was made to implement AutoCloseable interface.

Additionally all close methods have been marked with @Override annotation.

This change makes Document and PdfWriter implement AutoCloseable interface
either directly or indirectly. PdfWriter was made implement Closeable
as Closeable is an I/O interface and PdfWriter already deals with I/O.
This is similar to what PdfReader already does.

Document on the other hand doesn't do I/O so it was made to implement
AutoCloseable interface.

Additionally all `close` methods have been marked with `@Override`
annotation.
@andreasrosdal
Copy link
Contributor

Thanks, this is good.

By the way, what are you using OpenPDF for?

@andreasrosdal andreasrosdal merged commit a6a0caa into LibrePDF:master Mar 26, 2019
@wiktor-k
Copy link
Contributor Author

Adding translation of pages (shift page content a little bit left/right) using affine transforms. I didn't have any PDF experience though so it took a little bit more time than I expected but at the end it looks good 👍 except I could't use try-with-resources for Document and PdfWriter so I thought why not make a PR here :)

@wiktor-k wiktor-k deleted the add-closeable branch March 26, 2019 13:07
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

Successfully merging this pull request may close these issues.

2 participants