You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2014/09/29 17:34:34 UTC

[jira] [Closed] (PDFBOX-2393) PDF embeded with document can not parse.

     [ https://issues.apache.org/jira/browse/PDFBOX-2393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tilman Hausherr closed PDFBOX-2393.
-----------------------------------
    Resolution: Not a Problem

PDFBox is able to extract the excel file with this code:
{code}
List<PDPage> allPages = emDoc.getDocumentCatalog().getAllPages();
for (PDPage pdPage : allPages)
{
    List<PDAnnotation> annotations = pdPage.getAnnotations();
    for (PDAnnotation ann : annotations)
    {
        if (ann instanceof PDAnnotationFileAttachment)
        {
            PDAnnotationFileAttachment fann = (PDAnnotationFileAttachment) ann;
            PDComplexFileSpecification fileSpec = (PDComplexFileSpecification) fann.getFile();
            PDEmbeddedFile embeddedFile = fileSpec.getEmbeddedFile();
    
            FileOutputStream fos = new FileOutputStream(fileSpec.getFilename());
            fos.write(embeddedFile.getByteArray());
            fos.close();
        }
    }
}
{code}
So I am closing this issue as "not a problem", but you have inspired me to open issue PDFBOX-2394 to expand our example code.

> PDF embeded with document can not parse.
> ----------------------------------------
>
>                 Key: PDFBOX-2393
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2393
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Parsing
>    Affects Versions: 1.8.6
>         Environment: Windows7
>            Reporter: sunxingzhe
>         Attachments: embedded.pdf
>
>
> I insert a Excel file  into the pdf file.
> But  can not extracte embedded excel resources.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)