-
Notifications
You must be signed in to change notification settings - Fork 628
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
NullPointerException using PdfCopyFields (broken since v1.1.0) #500
Comments
Pull requests are welcome! |
|
@StefanOltmann I have fixed it, you can find the pull request |
Thank you! 😀 |
@asturio Nice. When will the next release to maven central happen? |
Let's see if I can go through some PR this weekend, so I can release in the next week. :-). It's great to have so much contribution. |
Describe the bug
Here is a sample document with a table of contents on the first page: openpdf_bug_test.pdf
I want to copy only the first page into a new file using code like this...
... and get this exception:
Since OpenPDF v1.1.0 it only works if I specify "1-2" as a range because otherwise a NullPointerException occurs due to the missing page refs in the table of contents.
Up to v1.0.5 it was possible to just copy range "1" and the missing page refs will be ignored.
To Reproduce
Full reproducer project:
OpenPdfBugReproducer.zip
Expected behavior
If a page has a reference to another page that's not part of the exported range this reference should just be ignored or stripped out. This seems to be what happens in version 1.0.5 and the old iText library.
Maybe you won't want to allow this per default, but then there should be a way better exception than a NullPointerException. But I would still need an option to force that copy even if page references get lost.
System (please complete the following information):
The text was updated successfully, but these errors were encountered: