Hello,

I've problem with embedded files in PDF document with this file
"http://download.eloit.de/czech/Test-Email mit Anlage.pdf"

Result: names == null

Code:

Writer output = null;
PDDocument document = null;

try {
      document = PDDocument.load(inputFile);
      PDDocumentCatalog catalog = document.getDocumentCatalog();
      PDDocumentNameDictionary names = catalog.getNames();

      if (names != null){
            PDEmbeddedFilesNameTreeNode embeddedFiles = 
names.getEmbeddedFiles();
            if (embeddedFiles != null){
                  Map<String,Object> embeddedFileNames = 
embeddedFiles.getNames();
                  if (embeddedFileNames != null) {
                        for (Map.Entry<String,Object> ent : 
embeddedFileNames.entrySet()) {
                              PDComplexFileSpecification spec = 
(PDComplexFileSpecification) ent.getValue();
                             PDEmbeddedFile file = spec.getEmbeddedFile();
                             System.out.println("subtype: " + 
file.getSubtype());
                        }
                  }
            }
      } else {
            System.out.println("names == null");
      }

} catch (IOException e) {
      System.err.println("load Document " + e.getMessage());
      return;
}

Thanks

Christian

________________________________

ELO Digital Office GmbH
Firmensitz: Heilbronner Strasse 150, 70191 Stuttgart
Fon: +49 711 806089-0, Fax: +49 711 806089-19, Web: www.elo.com
Gesch?ftsf?hrer: Karl Heinz Mosbach, Matthias Thiele
BW-Bank, Konto-Nr. 2089782, BLZ 600 501 01
Registergericht Stuttgart HRB 15059 - USt-IdNr.: DE812471516

Reply via email to