Have a look at tesseractmain.cpp e.g.:
https://github.com/tesseract-ocr/tesseract/blob/master/api/tesseractmain.cpp#L351

Zdenko

On Fri, Apr 28, 2017 at 10:05 AM, Saliaj Adrian <[email protected]> wrote:

> Hello,
>
> I am testing the Tesseract C++ API.
>
> Here is my code :
>
> #include <tesseract/baseapi.h>
> #include <leptonica/allheaders.h>
>
> int main()
> {
>     fprintf(stderr, "Heyhey !\n");
>     char * outText;
>
>     tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
>
>     if (api->Init(NULL, "fra")) {
>         fprintf(stderr, "Could not initialize tesseract.\n");
>         exit(1);
>     }
>
>     Pix * image = pixRead("/path/test.tif");
>     api->SetImage(image);
>
>     outText = api->GetUTF8Text();
>     printf("OCR output:\n%s", outText);
>
>     api->End();
>     delete [] outText;
>     pixDestroy(&image);
>
>     return 0;
> }
>
> It works and display the text output.
>
> But how can I get a searchable PDF file output and save it on my computer ?
>
> I mean, exactly like the command line : tesseract test.tif output pdf
>
> Thanks a lot
>
> --
> 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/28da1809-a51b-4918-a375-99ca6cd9c713%
> 40googlegroups.com
> <https://groups.google.com/d/msgid/tesseract-ocr/28da1809-a51b-4918-a375-99ca6cd9c713%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/CAJbzG8wGSSPLGSGww09sJDjAcbiykzfBMc2yp-HUi9hWsTyRyA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to