翻譯|使用教程|編輯:莫成敏|2019-12-20 13:29:53.553|閱讀 333 次
概述:本文介紹了使用LEADTOOLS OCR將屏幕截圖另存為可搜索的PDF文件的內容,希望對您有所幫助~
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
LEADTOOLS OCR Module - OmniPage Engine增加了對添加光學字符識別(OCR)和智能字符識別(ICR)技術到應用程序的方法,并且包含開發穩健的,高性能的和可擴展的圖像識別解決方案所需要的一切。本文介紹了使用LEADTOOLS OCR將屏幕截圖另存為可搜索的PDF文件的內容,希望對您有所幫助~
截屏是一種快速而簡便的獲取和共享信息的方法。雖然Windows提供了一個剪切工具,但它只能捕獲和保存圖像。使用此代碼,您可以保存圖像以及圖像中的文本。可以為該文本建立索引,以便以后可以使用Windows內置搜索找到信息。
使用.NET Clipboard Class,開發人員可以輕松地使用GetImageMethod來檢索存儲在剪貼板中的圖像。 從剪貼板中獲得圖像后,請使用LEADTOOLS通過ConvertFromImage方法將圖像轉換為RasterImage。 現在,您可以使用LEADTOOLS OCR SDK將新的RasterImage轉換為可搜索的PDF。
代碼
.NET代碼從剪貼板獲取圖像
public Image GetClipboardImage()
{
Image returnImage = null;
if (Clipboard.ContainsImage())
{
returnImage = Clipboard.GetImage();
}
return returnImage;
}LEADTOOLS OCR代碼可將剪貼板中的圖像另存為可搜索的PDF
string outputPath = $@"C:\Temp\{textBox1.Text}.pdf";
Image screenshot = GetClipboardImage();
using (RasterImage image = RasterImageConverter.ConvertFromImage(screenshot, ConvertFromImageOptions.None))
{
using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, false))
{
ocrEngine.Startup(codecs, null, null, null;
// Create an OCR document
using (IOcrDocument ocrDocument = ocrEngine.DocumentManager.CreateDocument())
{
// Add this image to the document
IOcrPage ocrPage = ocrDocument.Pages.AddPage(image, null);
// Auto-recognize the zones in the page
ocrPage.AutoZone(null);
// Recognize it and save it as a PDF file
ocrPage.Recognize(null);
ocrDocument.Save(outputPath, DocumentFormat.Pdf, null);
}
}
}
相關內容推薦:
包含OCR的產品有:LEADTOOLS Recognition Imaging Developer Toolkit、LEADTOOLS Document Imaging Suite Developer Toolkit、LEADTOOLS OCR Module - LEAD Engine、LEADTOOLS OCR Module - OmniPage Engine、LEADTOOLS ICR Module - OmniPage Engine、LEADTOOLS OCR Module - OmniPage Engine with Additional Languages,想要了解更多產品詳情請點擊
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@ke049m.cn
文章轉載自: