sselvia,

sselvia wrote
> Using the code below I'm trying to extract an embedded PDF which I can see
> in Reader.  The problem I'm having is the PdfArray file specs = embedded
> files.getAsArray(PdfName.NAMES);  The content of the embeddedfiles is an
> KIDS item not NAMES.

So in case of your file the Name Tree for the embedded files does not merely
have a leaf node but intermediate nodes, too. (Name Trees are described in
ISO 32000-1 section 7.9.6.)

Such non-minimal tree structures are seldomly used for embedded files (there
generally aren't a lot of embedded files, so the minimal structure is
usually sufficient). Therefore, most likely, (and because it was created
with iText-generated files in mind) the example code from listing 16.7
assumes a minimal tree here.

sselvia wrote
> If I change the code to be KIDS and execute the rest of the code the refs
> item is null.

Intermediate nodes in a name tree (KIDS indicates that you have such a node)
are built differently than leaf nodes (using NAMES). Thus, you have to
insert code to walk the KIDS nodes until you reach a leaf node.

Table 36 – Entries in a name tree node dictionary

Kids - array - (Root and intermediate nodes only; required in intermediate
nodes; present in the root node if and only if Names is not present) Shall
be an array of indirect references to the immediate children of this node.
The children may be intermediate or leaf nodes.

Names - array - (Root and leaf nodes only; required in leaf nodes; present
in the root node if and only if Kids is not present) Shall be an array of
the form
[key1 value1 key2 value2 … keyn valuen]
where each keyi shall be a string and the corresponding valuei shall be the
object associated with that key. The keys shall be sorted in lexical order,
as described below.

Limits - array - (Intermediate and leaf nodes only; required) Shall be an
array of two strings, that shall specify the (lexically) least and greatest
keys included in the Names array of a leaf node or in the Names arrays of
any leaf nodes that are descendants of an intermediate node.

(http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf)

Regards,   Michael



--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Extract-PDF-from-a-PDF-Collection-tp4657711p4657714.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to