Patagames Software Support Forum
»
Tesseract.Net SDK
»
F.A.Q.
»
Is there a way to make Tesseract.net work with streams rather than files on disk?
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,103
Thanks: 7 times Was thanked: 128 time(s) in 125 post(s)
|
Question:Hi, is there a way to make Tesseract.net work with streams rather than files on disk? My scenario is converting images that are stored in Azure blob storage and I would like to avoid downloading them to disk in order to convert them to PDF. Answer:Yes, of course. You can use the ProcessPage method in order to achieve this goal. Please look at following example: Code:
var api = OcrApi.Create();
api.Init(Languages.English);
using (var renderer = OcrPdfRenderer.Create(@"d:\0\output_pdf_file", @"tessdata"))
{
renderer.BeginDocument("document title");
foreach (Stream stream in streamCollection)
{
var bmp = Bitmap.FromStream(stream) as Bitmap;
using (var pix = OcrPix.FromBitmap(bmp))
{
api.ProcessPage(pix, null, 0, renderer);
}
}
renderer.EndDocument();
}
Edited by user Wednesday, October 19, 2016 8:04:58 AM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 7/6/2019(UTC) Posts: 4
|
Hi Is it possible to save the result pdf (from the code above) to a filestream instead of saving it to disk? Thanks in advance for your reply. Edited by user Saturday, August 3, 2019 5:53:16 AM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,103
Thanks: 7 times Was thanked: 128 time(s) in 125 post(s)
|
|
|
|
|
Patagames Software Support Forum
»
Tesseract.Net SDK
»
F.A.Q.
»
Is there a way to make Tesseract.net work with streams rather than files on disk?
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