Actually, things just work if I use the other constructor.
This is the constructor that works:
TessPDFRenderer(const char* outputbase, const char* datadir, bool textonly)
The other one failed.
Thanks for all the replies.
On Friday, July 21, 2017 at 4:57:25 PM UTC+10, Roger Jefferson wrote:
>
> 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/7fca23bd-cd09-4d13-8ccf-27eabbc7209a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.