logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
James  
#1 Posted : Tuesday, March 8, 2016 4:45:12 PM(UTC)
James

Rank: Newbie

Groups: Registered
Joined: 3/8/2016(UTC)
Posts: 1
United States

I'm processing multi-page tif files, creating multi-page pdf output. I need to get the hOcr output as well.

The ocr'd pdf output is being created as expected, but the hOcr output is only giving me the last page of the source file. I've tried a number of approaches.. In this two-page processing example, I get the second page output twice in the hOcr file:

Code:
using (var api = OcrApi.Create())
            {
                api.Init(Languages.English);

                using (var renderer = OcrPdfRenderer.Create(outputBase, TessDataDirectory))
                {
                    renderer.BeginDocument(string.Empty);
                    api.ProcessPages(tifFilePath, null, 0, renderer);
                    renderer.EndDocument();

                    var hOcrResult = new StringBuilder();

                    for (int i = 0; i < DirectoryUtils.PdfPagecount; i++)
                    {
                        hOcrResult.Append(api.GetHOCRText(i));
                    }

                    File.WriteAllText(string.Format("{0}.html", outputBase), hOcrResult.ToString());
                }
            }


Is there another technique I should be using with the GetHOCRText method, or maybe another approach entirely? Thanks.
Andrew  
#2 Posted : Wednesday, March 9, 2016 6:40:01 AM(UTC)
Guest

Rank: Guest

Groups: Guests
Joined: 1/5/2016(UTC)
Posts: 162

Was thanked: 5 time(s) in 5 post(s)
why you are not using OcrHocrRenderer just as OcrPdfRenderer?
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.