Rank: Newbie
Groups: Registered
Joined: 2/11/2017(UTC) Posts: 3  Thanks: 1 times
|
Like the description says, I'd like to run OcrApi.ProcessPages in a backgroundworker and update a progressbar on the main UI. Should I be running ProcessPage for each page individually, and if so, is there a way to ensure that I get the same output as ProcessPages? I like that I don't have to iterate the file with processpages, but it either runs it UI blocking, or with no way to inform the user that it's still processing other than the classic, crappy, "Please Wait".
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Hi, Originally Posted by: Toasterist  Should I be running ProcessPage for each page individually, and if so, is there a way to ensure that I get the same output as ProcessPages? ProcessPages uses the ProcessPage inside itself.
|
|
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 2/11/2017(UTC) Posts: 3  Thanks: 1 times
|
So how do I get all of the pages into the Pix format? If I feed it the same multipage tif file, then it only does the first page.
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Please look at following Code:
using (var api = OcrApi.Create())
{
api.Init(Languages.English);
using (var renderer = OcrPdfRenderer.Create(@"D:\1\3\file", @"tessdata"))
{
renderer.BeginDocument("Title");
var image = Image.FromFile(@"D:\1\3\PropostadeseguroFormigoni.tiff");
var pages = image.GetFrameCount(FrameDimension.Page);
for (int index = 0; index < pages; index++)
{
image.SelectActiveFrame(FrameDimension.Page, index);
using (var bmp = new Bitmap(image.Width, image.Height))
{
using (var g = Graphics.FromImage(bmp))
{
g.DrawImage(image, 0, 0, image.Width, image.Height);
}
var pix = OcrPix.FromBitmap(bmp);
api.ProcessPage(pix, null, 0, renderer);
}
}
renderer.EndDocument();
}
}
Edited by user Monday, February 13, 2017 2:56:58 PM(UTC)
| Reason: Not specified
|
 1 user thanked Paul Rayman for this useful post.
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 2/11/2017(UTC) Posts: 3  Thanks: 1 times
|
Oh, I see. I could not have been more confused. I figured there was some imaging class in the OCR API that I was missing. Cheers! Great product.
|
|
|
|
|
|
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.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close