Description
This document opens fine in Adobe Reader.While extracting page labels from getLabelsByPageIndices() i got the below exception
java.lang.ArrayIndexOutOfBoundsException: 3
at org.apache.pdfbox.pdmodel.common.PDPageLabels$2.newLabel(PDPageLabels.java:218)
at org.apache.pdfbox.pdmodel.common.PDPageLabels.computeLabels(PDPageLabels.java:252)
at org.apache.pdfbox.pdmodel.common.PDPageLabels.getLabelsByPageIndices(PDPageLabels.java:214)
ORIGINAL CODE IN PDPageLabels.java
public String[] getLabelsByPageIndices()
{
final String[] map = new String[doc.getNumberOfPages()];
computeLabels(new LabelHandler()
{
public void newLabel(int pageIndex, String label)
});
return map;
}
It works fine with the below modified code in PDPageLabels.java
MODIFIED CODE IN PDPageLabels.java
public String[] getLabelsByPageIndices()
{
final String[] map = new String[doc.getNumberOfPages()];
computeLabels(new LabelHandler()
{
public void newLabel(int pageIndex, String label)
{
if(pageIndex < doc.getNumberOfPages())
}
});
return map;
}