> Got it now with the execute method.
>
> Nevertheless I would like to understand, why my posted code did not
work.
The answer lies within the code to "execute". This part in particular:
PdfDictionary names = catalog.getAsDict(PdfName.NAMES);
if (names != null) {
PdfDictionary embFiles = names.getAsDict(new
PdfName("EmbeddedFiles"));
if (embFiles != null) {
HashMap< String, PdfObject > embMap =
PdfNameTree.readTree(embFiles);
for (Iterator< PdfObject > i = embMap.values().iterator();
i.hasNext()){
PdfDictionary filespec = (PdfDictionary) PdfReader
.getPdfObject(i.next());
unpackFile(reader, filespec, outPath);
}
}
}
In Plain English, the dictionary stored in the EmbeddedFiles key is a
bunch of name/value pairs where the values are (I believe)
PdfIndirectReferences to file specification dictionaries. The
unpackFile function expects a single fileSpec dictionary. << /Type
/FileSpec ... >>
A more helpful error message from unpackFile might be nice rather than
simply returning. Something like throw new DocumentException("That
dictionary isn't of /Type /FileSpec"). At least then you would have
known you weren't passing in the correct dictionary. That may not have
helped you, but then again...
OTOH, I didn't think the toolbox code was supported anymore, so it
surprises me to see generics used in there. Live & learn.
--Mark Storer
Senior Software Engineer
Cardiff.com
import legalese.Disclaimer;
Disclaimer<Cardiff> DisCard = null;
> -----Original Message-----
> From: _apollo [mailto:[email protected]]
> Sent: Friday, June 18, 2010 6:47 AM
> To: [email protected]
> Subject: Spam: Re: [iText-questions] How to extract embedded file ?
>
>
> --
> View this message in context: http://itext-
> general.2136553.n4.nabble.com/How-to-extract-embedded-file-
> tp2247128p2260226.html
> Sent from the iText - General mailing list archive at Nabble.com.
>
>
------------------------------------------------------------------------
--
> ----
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit. See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Buy the iText book: http://www.itextpdf.com/book/
> Check the site with examples before you ask questions:
> http://www.1t3xt.info/examples/
> You can also search the keywords list:
> http://1t3xt.info/tutorials/keywords/
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 9.0.829 / Virus Database: 271.1.1/2944 - Release Date:
06/17/10
> 23:35:00
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/