You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using(IResultRendererrenderer=Tesseract.PdfResultRenderer.CreatePdfRenderer(@"test.pdf",@"./tessdata",false)){// PDF Titleusing(renderer.BeginDocument("Serachablepdftest")){stringconfigurationFilePath=@"C:\tessdata";using(TesseractEngineengine=newTesseractEngine(configurationFilePath,"eng",EngineMode.TesseractAndLstm)){using(varimg=Pix.LoadFromFile(@"C:\file-page1.jpg")){using(varpage=engine.Process(img,"Serachablepdftest")){renderer.AddPage(page);}}}}}
Image to pdf returning file bytes
vartmpPdfLocation="./tessdata/pdf";varsep=Path.PathSeparator;vartmpFile=tmpPdfLocation+sep+Path.GetTempFileName();bytes[]fileBytes=null;using(IResultRendererrenderer=Tesseract.PdfResultRenderer.CreatePdfRenderer(tmpFile,@"./tessdata",false)){// PDF Titleusing(renderer.BeginDocument("Serachablepdftest")){// string configurationFilePath = @"C:\tessdata";using(TesseractEngineengine2=newTesseractEngine(configurationFilePath,"eng",EngineMode.TesseractAndLstm)){using(varimg=Pix.LoadFromFile(@"C:\file-page1.jpg")){using(varpage=engine.Process(img,"Searchablepdftest")){renderer.AddPage(page);}}}}}// on dispose file should be createdvarstream=newFileStream(tmpFile,FileMode.Open,FileAccess.Read);MemoryStreamms=newMemoryStream();stream.CopyTo(ms);fileBytes=ms.ToArray();stream.Dispose();ms.Close();// delete tmp fileFile.Delete(tmpFile);