I want to use tesseract 3.05 to generate searchable PDF programmatically in 
C++. Here is my code:

int main(int argc, const char * argv[]){
    tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
    // Initialize tesseract-ocr with English, without specifying tessdata path
    if (api->Init(NULL, "eng")) {
        fprintf(stderr, "Could not initialize tesseract.\n");
        exit(1);
    }
    Pix *image = pixRead("/Users/user1/pictures/page1.png");

    tesseract::TessResultRenderer* renderer = new 
tesseract::TessPDFRenderer("/Users/user1/Documents/", 
"/usr/local/share/tessdata");
    api->ProcessPage(image, 0, "/Users/user1/Documents/page1_pdf", NULL, 0, 
renderer);
    api->End();

    pixDestroy(&image);
    delete renderer;

    return 0;}


The problem is everytime I get to api->ProcessPage() I keep getting 
assertion error:

size_used_ > 0:Error:Assert failed:in file ../ccutil/genericvector.h, line 
696

Can anyone help? What's wrong? Is there a better way to generate PDF output?

Thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tesseract-ocr/5e66b13b-5dce-4920-bbc8-dc16e201ef62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to