The command line works OK but I need to integrate this. So, I need to do this in C++.
On Friday, July 21, 2017 at 6:25:14 PM UTC+10, shree wrote: > > Are you able to create pdfs using commandline? > > ShreeDevi > ____________________________________________________________ > भजन - कीर्तन - आरती @ http://bhajans.ramparivar.com > > On Fri, Jul 21, 2017 at 12:09 PM, Roger Jefferson <[email protected] > <javascript:>> 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] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> 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 >> >> <https://groups.google.com/d/msgid/tesseract-ocr/5e66b13b-5dce-4920-bbc8-dc16e201ef62%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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/af0c5f69-1cd6-42b4-ae19-30cc603394c5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

