danfickle / danfickle/openhtmltopdf

IndexOutOfBoundsException on empty div referenced as an anchor

Open
#261 2 comments 0 reactions 1 assignee Claimed by @danfickle View on GitHub
Dominant language
Java
Stars
2.2k
Forks
423
PR merge metrics
No merged PRs in 30d

Description

Hello-

Sample HTML file below will produce an index out of bounds exception. I studied the code in depth and have figured out how to work around it but haven't quite figured out the cause.

**Stacktrace:**
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index out of bounds: 2
at org.apache.pdfbox.pdmodel.PDPageTree.get(PDPageTree.java:286)
at org.apache.pdfbox.pdmodel.PDPageTree.get(PDPageTree.java:211)
at org.apache.pdfbox.pdmodel.PDDocument.getPage(PDDocument.java:1392)
at com.openhtmltopdf.pdfboxout.PdfBoxLinkManager.createDestination(PdfBoxLinkManager.java:356)

[PdfBoxLinkManager.txt](https://github.com/danfickle/openhtmltopdf/files/2272090/PdfBoxLinkManager.txt)
[sample.txt](https://github.com/danfickle/openhtmltopdf/files/2272091/sample.txt)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.