Details
Description
Opening and saving a PDF causes this exception in 1.8.2:
Exception in thread "main" java.lang.ClassCastException: org.apache.pdfbox.cos.COSString cannot be cast to org.apache.pdfbox.cos.COSName
at org.apache.pdfbox.pdfwriter.COSWriter.doWriteObject(COSWriter.java:507)
at org.apache.pdfbox.pdfwriter.COSWriter.doWriteBody(COSWriter.java:435)
at org.apache.pdfbox.pdfwriter.COSWriter.visitFromDocument(COSWriter.java:1122)
at org.apache.pdfbox.cos.COSDocument.accept(COSDocument.java:552)
at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1501)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1324)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1305)
The PDF is here: http://digitalcorpora.org/corp/nps/files/govdocs1/008/008677.pdf
Code to reproduce the exception:
PDFParser parser = new PDFParser(new FileInputStream(new File("008677.pdf")));
parser.parse();
File temp = File.createTempFile("temp-", ".pdf");
parser.getPDDocument().save(temp);
parser.getDocument().close();
Attachments
Attachments
Issue Links
- is depended upon by
-
TIKA-1306 ClassCastException WARN [main] (COSDocument.java:303) - java.lang.ClassCastException: org.apache.pdfbox.cos.COSString cannot be cast to org.apache.pdfbox.cos.COSName in o.a.t.parser.pdf.PDFParserTest
- Resolved
- relates to
-
PDFBOX-3021 Class Cast Exception: COSString -> COSName
- Closed