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

Destination with index #133

Merged
merged 10 commits into from
Sep 12, 2020
Merged

Destination with index #133

merged 10 commits into from
Sep 12, 2020

Conversation

gtache
Copy link
Contributor

@gtache gtache commented Sep 3, 2020

Fixes #132

@@ -236,6 +240,12 @@ private void parse(List v) {
Object ob = getDestValue(0, v);
if (ob instanceof Reference) {
ref = (Reference) ob;
} else if (ob instanceof Integer) {
Copy link
Owner

@pcorless pcorless Sep 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably suggest somthing like, not point keeping the pageTree reference around:

// Dest could be a page number instead of a reference
final int idx = (int) ob;
PageTree pageTree = library.getCatalog().getPageTree();
if (idx >= 0 && idx < pageTree.getNumberOfPages()) {
ref = pageTree.getPageReference(idx);
}

Interstingly this is one of those special corners cases were the notion isn't in the specification.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I was tired, I was assuming we didn't have access to library in this object for some reason...
Thanks for pointing that out.
Yeah I found that quite strange, I don't know how that pdf got created.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries and thank you for providing the fix!

@pcorless pcorless merged commit 84c3a06 into pcorless:master Sep 12, 2020
@gtache gtache deleted the indexDestination branch September 23, 2020 09: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.

Destination / Bookmarks don't always work
2 participants