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

Notification

Icon
Error

Options
Go to last post Go to first unread
Paul Rayman  
#1 Posted : Wednesday, October 19, 2016 8:01:44 AM(UTC)
Paul Rayman

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

Jan-Willem  
#2 Posted : Saturday, August 3, 2019 5:52:38 AM(UTC)
Jan-Willem

Rank: Newbie

Groups: Registered
Joined: 7/6/2019(UTC)
Posts: 4
Netherlands

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

Paul Rayman  
#3 Posted : Sunday, August 4, 2019 1:48:38 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,103

Thanks: 7 times
Was thanked: 128 time(s) in 125 post(s)
Unfortunately no.
Users browsing this topic
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.