I need to parse an IDML file and save the images separately from that file in formats for the Web. Can I do that IDMLlib? And if it's possible then can you show me some examples? P.S. The documentation of that library is awful, and the examples are horrible.
IDML files, very famously, do not 'contain' the base-64 encoded image data for linked images, only for embedded ones. For linked images only their physical locations on the original machine are stored.
Embedded images are found inside "Spread_uXX.xml" files, in a tag <Image>
. This tag contains the image dimensions and some other meta-information, and a sub-tag <Contents>
that lists the CDATA in Base-64. Be warned: there may be more than a single block of CDATA for each image.
The type of embedded images may or may not be the same as the original; the Image tag should declare the type in an attribute ImageTypeName
. If the file format is not one you can use 'for the web', you need to convert it yourself.
I don't use IDMLlib so I cannot comment on its examples style.