afpdev / alpheusafpparser

Library & parser for IBM Advanced Function Presentation (AFP) document/print stream format
GNU General Public License v3.0
16 stars 11 forks source link

Error getting image data #22

Closed AkashChikane closed 5 years ago

AkashChikane commented 5 years ago

com.mgz.afp.exceptions.AFPParserException: An exception occured when parsing structured field at file index position 0x19c. com.mgz.afp.exceptions.AFPParserException: An exception occured when parsing structured field at file index position 0x21a9. com.mgz.afp.exceptions.AFPParserException: An exception occured when parsing structured field at file index position 0x41b6.

getting this error while parsing afp with ioca image

can you provide any exaple how to extract image from afp file?

mogozine commented 5 years ago

Hi,

you may use afpdev/herculesafpeditor in order to introspect the AFP file and find out the type of the structured field(SF) that causes the problem.

You can set AFPParserConfiguration.isParseToStructuredFieldsBaseData = true. With this option set, the parser doesn't attempt to parse the internal structure of SF but produces objects of type StructuredFieldBaseData which consists of a StructuredFieldIntroducer (the header info) and the bare payload of the SF as a byte array. This may help in case the exception occurs due to a bug in one of the SF-classes of the Alpheus AFP parser. If this works you can take the payload data and work your way down to the actual image data. You can find all AFP specs at the AFP Consortium.

Unfortunately, I can not provide you with an example how to extract image data from AFP files.