[
https://issues.apache.org/jira/browse/PDFBOX-1756?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14011065#comment-14011065
]
Tim Allison commented on PDFBOX-1756:
-------------------------------------
Thank you!
> ClassCastException CosString cannot be cast to COSName
> ------------------------------------------------------
>
> Key: PDFBOX-1756
> URL: https://issues.apache.org/jira/browse/PDFBOX-1756
> Project: PDFBox
> Issue Type: Bug
> Components: Parsing
> Affects Versions: 1.8.2
> Environment: Ubuntu Linux & Windows 7 (both JDK6)
> Reporter: William Palmer
> Assignee: Tilman Hausherr
> Priority: Minor
> Fix For: 1.8.6, 2.0.0
>
> Attachments: testPDF_twoAuthors.pdf
>
>
> 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();
--
This message was sent by Atlassian JIRA
(v6.2#6252)