RecAPI
Document

The document-level processing is supported on: Windows, Linux, Embedded Linux, Mac OS X.

The document is a page container containing a set of pages HPAGE in User-defined order. The document can be accessed through handles HDOC. The integrating application can insert pages into a document (RecInsertPage) or remove them (RecDeletePage). To modify a document, open it with RecOpenDoc. After changes are made the document should be closed (RecCloseDoc). The recognition should be run on pages. The aim of the document is only to collect the recognized pages so they are passed to the output conversion as a unit.

The recognition of each HPAGE is performed by kRecRecognize of the page-level processing. Another way to recognize pages is to use one-step processing, but it works at page level and not document level.

The integrating application can also save the document into an OPD file (the format of the application ScanSoft OmniPage 20) or load a document from such a file.

When the document is ready, the application can export it by RecConvert2Doc. The format of the created output file can be set by RecSetOutputFormat. The Capture SDK provides many format-specific settings and fine-tuning controls that influence the properties of the output document. For more information, see the topic output.

Note:
The following example shows a typical multi-page processing:
    RECERR rc;
    HPAGE hPage;
    HIMGFILE hIFile;
    HDOC hDoc;
    int pageCnt, i;

    // Initialize engine.
    rc = RecInitPlus(YOUR_COMPANY, YOUR_PRODUCT);
    // Create a new document.
    rc = RecCreateDoc(0, "test.opd", &hDoc, DOC_NORMAL);
    // Load image.
    rc = kRecOpenImgFile("multipage.tif", &hIFile, IMGF_READ, (IMF_FORMAT)0);
    // Get number of pages.
    rc = kRecGetImgFilePageCount(hIFile, &pageCnt);
    // Cycle through the pages.
    for(i=0;i<pageCnt;i++)
    {
        // Load current page.
        rc = kRecLoadImg(0, hIFile, &hPage, i);
        // Preprocess image.
        rc = kRecPreprocessImg(0, hPage);
        // Recognize image.
        rc = kRecRecognize(0, hPage, NULL);
        // Add page to document. Don't have to free up HPAGE, because RecInsertPage frees it up.
        rc = RecInsertPage(0, hDoc, hPage, -1);
    }
    // Close file.
    rc = kRecCloseImgFile(hIFile);
    // Set output format and level.
    rc = RecSetOutputFormat(0, "Converters.Text.Rtf2000");
    rc = RecSetOutputLevel(0, OL_FLOWINGPAGE);
    // Convert document to and RTF file
    rc = RecConvert2Doc(0, hDoc, "test.rtf");
    // Close document.
    rc = RecCloseDoc(0, hDoc);
    // Stop engine.
    rc = RecQuitPlus();