File Content Extraction 25.2
Filter SDK C Programming Guide

# Access a Subfile without Extracting the Entire File

Some operations do not require all of the data contained within a subfile. For example, format detection can often be performed using only the beginning and end of a file, without needing to extract the entire file to disk or memory. When filtering, you might process part of a file before deciding not to continue.

Extracting only part of a subfile can take less time and improve the performance of your application. For this reason, you can open a subfile as an input stream, which you can pass to another File Content Extraction context or use in your own code.

NOTE: You cannot use the reader `pdf2sr` when extracting files to a stream.

To open a subfile as an input stream

1. Follow the instructions for extracting subfiles as far as calling `fpGetMainFileInfo()` to ascertain that the main file is a container.

2. Open the subfile by calling fpOpenSubFile().

3. Use the returned stream as required. For example, you can pass the `KVInputStream` to fpGetDocInfoStream() or pass it to fpOpenStream() and then filter the subfile.

   NOTE: Input streams derived from the same context are not thread-safe so OpenText strongly recommends that streams are used only on the thread on which they were created. However, to pass a KVInputStream back into File Content Extraction, you must create a new context using fpInit().

   If a problem is encountered when using the stream, you can call fpGetExtractStatus() to establish the cause of the problem.

4. Free resources using fpCloseSubFile() and fpFreeStruct().

Copyright 1997-2025 Open Text
Version 25.2 | Last updated April 2025

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: File Content Extraction 25.2

Topic Title: Access a Subfile without Extracting the Entire File