[ 
https://issues.apache.org/jira/browse/PDFBOX-1599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13659708#comment-13659708
 ] 

Andreas Lehmkühler commented on PDFBOX-1599:
--------------------------------------------

Can you provide us with a sample pdf?
                
> ConvertToImage gets ClassCastException with Checkboxes in PDFForm
> -----------------------------------------------------------------
>
>                 Key: PDFBOX-1599
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1599
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 1.8.1
>         Environment: Windows Vista, Java 1.6
>            Reporter: Jens Vogt
>            Priority: Critical
>              Labels: patch
>
> When creating an image from a PDF Form we get an CastCastException in:
> Exception in thread "main" java.lang.ClassCastException: 
> org.apache.pdfbox.cos.COSName cannot be cast to 
> org.apache.pdfbox.cos.COSStream
>         at 
> org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary.getNormalAppearance(PDAppearanceDictionary.java:103)
>         at 
> org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:140)
>         at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:781)
>         at 
> org.apache.pdfbox.examples.util.Extraction$BarcodeLocator.getBarcode(Extraction.java:418)
>         at 
> org.apache.pdfbox.examples.util.Extraction$BarcodeLocator.access$000(Extraction.java:379)
>         at 
> org.apache.pdfbox.examples.util.Extraction.<init>(Extraction.java:103)
>         at 
> org.apache.pdfbox.examples.util.Extraction.main(Extraction.java:138)
> An further analysis shows that it seems to be related to checkboxes on the 
> PDF Form. I fixed it temporarily using:
> try
>                       {
>                               COSStream as = 
> (COSStream)map.getDictionaryObject( asName );
>                               actuals.put( asName.getName(), new 
> PDAppearanceStream( as ) );
>                       }
>                       catch (ClassCastException ex)
>                       {
>                               System.err.println("Exception name: " + 
> asName.getName());
>                       }
> in PDAppearanceDictionary.java.
> Best regards
> Jens

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to