File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
main/java/org/apache/pdfbox/pdfparser
test/java/org/apache/pdfbox/pdfparser Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -999,6 +999,15 @@ private COSNumber parseCOSNumber() throws IOException
999999 {
10001000 source .rewind (1 );
10011001 }
1002+
1003+ // PDFBOX-5025: catch "74191endobj"
1004+ char lastc = buf .charAt (buf .length () - 1 );
1005+ if (lastc == 'e' || lastc == 'E' )
1006+ {
1007+ buf .deleteCharAt (buf .length () - 1 );
1008+ source .rewind (1 );
1009+ }
1010+
10021011 return COSNumber .get (buf .toString ());
10031012 }
10041013
Original file line number Diff line number Diff line change 2525import java .net .URISyntaxException ;
2626
2727import org .apache .pdfbox .Loader ;
28+ import org .apache .pdfbox .cos .COSName ;
2829import org .apache .pdfbox .pdmodel .PDDocument ;
2930import org .apache .pdfbox .pdmodel .PDDocumentInformation ;
31+ import org .apache .pdfbox .pdmodel .font .PDFont ;
3032import org .apache .pdfbox .pdmodel .interactive .documentnavigation .outline .PDDocumentOutline ;
3133import org .apache .pdfbox .pdmodel .interactive .documentnavigation .outline .PDOutlineItem ;
3234import org .apache .pdfbox .rendering .PDFRenderer ;
@@ -348,4 +350,20 @@ void testPDFBox4490() throws IOException
348350 }
349351 }
350352
353+ /**
354+ * PDFBOX-5025: Test for "74191endobj"
355+ *
356+ * @throws IOException
357+ */
358+ @ Test
359+ void testPDFBox5025 () throws IOException
360+ {
361+ try (PDDocument doc = Loader .loadPDF (new File (TARGETPDFDIR , "PDFBOX-5025.pdf" )))
362+ {
363+ assertEquals (1 , doc .getNumberOfPages ());
364+ PDFont font = doc .getPage (0 ).getResources ().getFont (COSName .getPDFName ("F1" ));
365+ int length1 = font .getFontDescriptor ().getFontFile2 ().getCOSObject ().getInt (COSName .LENGTH1 );
366+ assertEquals (74191 , length1 );
367+ }
368+ }
351369}
You can’t perform that action at this time.
0 commit comments