Rank: Newbie
Groups: Registered
Joined: 4/8/2018(UTC) Posts: 4  Location: Amman Thanks: 2 times
|
Hi,
I am trying out the trial,and i have some questions/cases before buying the license.
1. the first case, I tried to convert a scope of individual images into one PDF file using MultiplyImages2Pdf() code and plain text file as in your sample, one of the images list is Multi Tiff image , in this case the code OCR-ed only the first frame in the multi Tiff image but when I tried the same multi Tiff alone it worked fine, can you please help me to solve this case.
2. the second case, when i tried to extract a text from multi tiff image using api.GetTextFromImage() method , in this case i also got only the first frame from the multi tiff image, i need to OCR a multitiff image to a text not PDF,
3. i noticed that one of Init method signature has an array of languages, is that mean i can OCR the images using multiple languages at the same time, if yes can you please provide me the way to do that, if no can you please explain the different between the two signatures below. ** I need English & Arabic languages
--public void Init(Languages[] language, string dataPath = null, OcrEngineMode oem = OcrEngineMode.OEM_DEFAULT, string[] configs = null, string[] varsVec = null, string[] varsValues = null, bool setOnlyNonDebugParams = false);
--public void Init(Languages language, string dataPath = null, OcrEngineMode oem = OcrEngineMode.OEM_DEFAULT, string[] configs = null, string[] varsVec = null, string[] varsValues = null, bool setOnlyNonDebugParams = false);
Thanks in advance.
|
|
|
|
|
|
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: fhaddad  1. the first case, I tried to convert a scope of individual images into one PDF file using MultiplyImages2Pdf() code and plain text file as in your sample, one of the images list is Multi Tiff image , in this case the code OCR-ed only the first frame in the multi Tiff image but when I tried the same multi Tiff alone it worked fine, can you please help me to solve this case.
Do not use text file. Just process it by self. Quote: 2. the second case, when i tried to extract a text from multi tiff image using api.GetTextFromImage() method , in this case i also got only the first frame from the multi tiff image, i need to OCR a multitiff image to a text not PDF,
try the following Code:
using (var api = OcrApi.Create())
{
api.Init(Languages.English);
var image = Image.FromFile(@"D:\0\multipage.tif");
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);
}
string text = api.GetTextFromImage(bmp);
}
}
}
Quote: 3. i noticed that one of Init method signature has an array of languages, is that mean i can OCR the images using multiple languages at the same time, if yes can you please provide me the way to do that, if no can you please explain the different between the two signatures below. ** I need English & Arabic languages
Code:
Languages[] langs = { Languages.English, Languages.Arabic };
api.Init(langs,...);
or you can download appropriate language here https://tesseract.patagames.com/langs/Edited by user Thursday, April 12, 2018 6:04:39 AM(UTC)
| Reason: Not specified
|
 1 user thanked Paul Rayman for this useful post.
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 4/8/2018(UTC) Posts: 4  Location: Amman Thanks: 2 times
|
Hi,
Thanks a lot for your reply.
** Regarding to first point, by business case is to convert a group of MULTI TIFF images into one PDF file because of that I tried to use the text file and didn't process the image by it self. If you can recommend any solution for my business case,,,
** Regarding to second case, your solution worked fine, Thanks a lot.
** Regarding to multi language case, I tried your solution but I got an error "System.AccessViolationException",,,
Thanks again.
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Quote: ** Regarding to multi language case, I tried your solution but I got an error "System.AccessViolationException".
Did you download appropriate language pack? Please provide more info about exception. Your code, call stacl etc
|
 1 user thanked Paul Rayman for this useful post.
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 4/8/2018(UTC) Posts: 4  Location: Amman Thanks: 2 times
|
Hi, Yes I download the language using this link "https://tesseract.patagames.com/langs/" and add it to my project as below image  lang.png (8kb) downloaded 9 time(s).Kindly note that when I'm trying Arabic language alone or English language alone it's working fine but when I'm trying both language as image below I got the error. ** My code -->  code.png (6kb) downloaded 9 time(s).Error --> ** I got the error when call api.GetTextFromImage(..) method.  error.png (21kb) downloaded 9 time(s).Thanks.
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
|
|
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 4/8/2018(UTC) Posts: 4  Location: Amman Thanks: 2 times
|
Hi, any Feedback/update regarding to multi tiff images Quote: ** Regarding to first point, by business case is to convert a group of MULTI TIFF images into one PDF file because of that I tried to use the text file and didn't process the image by it self. If you can recommend any solution for my business case,,,
Quote:Originally Posted by: fhaddad Go to Quoted Post
1. the first case, I tried to convert a scope of individual images into one PDF file using MultiplyImages2Pdf() code and plain text file as in your sample, one of the images list is Multi Tiff image , in this case the code OCR-ed only the first frame in the multi Tiff image but when I tried the same multi Tiff alone it worked fine, can you please help me to solve this case.
Do not use text file. Just process it by self. Thanks,
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Quote: ** Regarding to first point, by business case is to convert a group of MULTI TIFF images into one PDF file because of that I tried to use the text file and didn't process the image by it self. If you can recommend any solution for my business case,,,
Quote:Originally Posted by: fhaddad Go to Quoted Post
1. the first case, I tried to convert a scope of individual images into one PDF file using MultiplyImages2Pdf() code and plain text file as in your sample, one of the images list is Multi Tiff image , in this case the code OCR-ed only the first frame in the multi Tiff image but when I tried the same multi Tiff alone it worked fine, can you please help me to solve this case.
Do not use text file. Just process it by self. Code:
using (var api = OcrApi.Create())
{
api.Init(Languages.English);
using (var renderer = OcrPdfRenderer.Create(@"D:\4\output_pdf", @"tessdata"))
{
renderer.BeginDocument("Title");
//Get a path to tiff file and use it in the row below
var image = Image.FromFile(@"D:\4\1_JPEG.tif");
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);
}
using (var pix = OcrPix.FromBitmap(bmp))
{
api.ProcessPage(pix, null, 0, renderer);
}
}
}
// <-------------- GoTo line 7
renderer.EndDocument();
}
}
Edited by user Thursday, April 19, 2018 2:35:21 AM(UTC)
| Reason: Not specified
|
|
|
|
|
|
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