Extract Subfiles

To convert all files in a container file, you must open the container and extract its subfiles by using the File Extraction API. The extraction process is done repeatedly until all subfiles are extracted and exposed for conversion. After a subfile is extracted, you can call Export API functions to convert the file.

If you want to convert a container file and its subfiles to a single file, you must extract all files from the container, convert the files, and then append each converted output file to its parent.

To extract subfiles

  1. Call KVGetExtractInterface(), and pass in the context pointer that you initialized using fpInit(), and the address of a structure that contains pointers to the File Extraction API functions.

  2. Declare the input stream or file name in the KVOpenFileArg structure.

  3. Open the source file by calling fpOpenFile() and passing the KVOpenFileArg structure. This call defines the parameters necessary to open a file for extraction.

  4. Determine whether the source file is a container file (that is, whether it contains subfiles) by calling fpGetMainFileInfo().

  5. If the call to fpGetMainFileInfo() determined that the source file is a container file, proceed to step 6; otherwise, convert the file.

  6. Determine whether the subfile is itself a container (that is, whether it contains subfiles) by calling fpGetSubFileInfo().

  7. Extract the subfile by calling fpExtractSubFile().

  8. If the call to fpGetSubFileInfo() determined that the subfile is a container file, repeat step 2 through step 7 until all subfiles are extracted and the lowest level of subfiles is reached; otherwise, convert the file.