與其他組件的比較 IronOCR 和 PDFTRON OCR 之間的比較 Kannapat Udonpant 更新日期:7月 28, 2025 Download IronOCR NuGet 下載 DLL 下載 Windows 安裝程式 Start Free Trial Copy for LLMs Copy for LLMs Copy page as Markdown for LLMs Open in ChatGPT Ask ChatGPT about this page Open in Gemini Ask Gemini about this page Open in Grok Ask Grok about this page Open in Perplexity Ask Perplexity about this page Share Share on Facebook Share on X (Twitter) Share on LinkedIn Copy URL Email article OCR 代表“光學字符識別”。 這是將紙質文件或圖像轉換為可讀文本的過程。 有多種方法可以做到這一點,例如掃描或通過鍵盤手動輸入。 這樣做是為了將任何掃描的文件和 PDF 轉換為其原始文本格式。 這一過程在刑事案件中被證明是無價的,當文件因損壞而無法手動轉錄時,可以使用 OCR 軟件進行掃描和解釋。 隨著技術的進步和數字工具的廣泛應用,OCR 也被應用到其他領域,例如應用程式上的文件轉換,如 Google Docs,以及學術界和商業界。 OCR 主要分為兩種類型,“靜態”和“動態”。 最常見的類型是靜態 OCR,其中整個文件一次掃描。 另一方面,動態 OCR 則一次掃描一行,可以處理更為複雜的佈局,例如表格數據。 本文將討論兩種最常見的應用程序和文檔庫之間的比較,用於 OCR 和 PDF。 它們是: PDFTron OCR IronPDF 1.0 簡介 1.1 PDFTron OCR 介紹和功能 要在 PDFTron SDK 中使用 OCR,我們需要安裝一個單獨的 OCR 模組附加實用程序。 這有助於 SDK 從文檔中檢測文本。 它可以使文本可選擇性並可搜尋。 PDFTron SDK 支持多達 100 種語言。 PDFTron OCR 引擎由 Tesseract 的開源 LSTM 神經網絡支持。 PDFTron OCR 支持多種圖像格式用於文本檢測。 僅含光柵圖像的 PDF 文件也可接受 OCR,輸出質量取決於輸入圖像。 OCR 的最佳圖像是具有 300 DPI 分辨率的灰度圖像。 PDFTron OCR 的功能 使印刷文件中的圖像可搜尋。 將簡單的 PDF 轉換為可搜尋的 PDF。 從商務文件中檢測重要信息。 使掃描書籍變得更輕鬆。 從車輛圖像中檢測車輛號碼。 幫助視障用戶。 可以輕鬆地在多個文件中進行數據錄入。 將名片中的信息輕鬆轉移到聯繫人數據列表。 1.2 IronOCR — 介紹和特性 Iron Software 提供軟件工程師使用 IronOCR for .NET 從 .NET 應用程序和網站中的照片和 PDF 閱讀文本內容。 該軟件有助於掃描照片以獲取文本和條形碼,支持多種世界語言,並以純文本或結構化數據格式輸出。 Iron Software 的 OCR 庫可以在 Web、控制台、MVC 和多個 .NET 桌面應用程序中使用。 在商業部署的情況下,除了購買的許可證外,還提供來自開發團隊的直接協助。 IronPDF uses the latest Tesseract 5 engine which reads text, QR codes, and barcodes, from any PDF format or. 在桌面、Web 應用程序和控制台中添加此庫的 OCR 確保快速集成。 IronPDF supports 125 international languages. 它還支持自定義語言和詞列表。 IronPDF can read more than 20 barcode and QR code formats. 支持多頁 GIF 和 TIFF 圖像格式。 校正低質量掃描和圖像。 支持多執行緒。 它可以同時執行一個或多個進程。 IronPDF can provide structured data output to pages, paragraphs, lines, words, characters, etc. IronPDF supports operating systems such as Windows, Linux, macOS, etc. 2. 在 Visual Studio 中創建新項目 打開 Visual Studio 並找到“文件”菜單。 選擇新項目,然後選擇“控制台應用程序”。 要生成 PDF 文檔,我們將在本文中使用控制台應用程序。 class="content-img-align-center"> class="content__image-caption"> 在相應的文本框中輸入項目名稱並選擇文件路徑。 然後,單擊Create按鈕。 此外,選擇所需的 .NET Framework。 Visual Studio 項目將立即生成選定應用程序的結構。 Visual Studio 現在將生成項目結構。 如果您選擇了 Windows、控制台和 Web 應用程序,program.cs 文件將打開,以便您可以輸入代碼並構建/運行應用程序。 class="content-img-align-center"> class="content__image-caption"> 下一步,我們需要添加庫來測試代碼。 3.0 安裝 3.1 安裝 PDFtron OCR The PDFTron OCR installation is completed manually and can be downloaded as a zip from the given link. 解壓縮並配置到項目中。 該指南將幫助您使用 PDFTron SDK 的免費集成試用版將 PDFTron 示例運行於 Windows 上的 .NET 框架應用程序中。 解決方案工程師的支持和無限制的試用次數包含於免費試用版中。 先決條件 Visual Studio: 確保您的安裝中包含 .NET 桌面開發和 .NET 框架 4.5.1+ 開發工具 工作負載。 本指南將使用 Visual Studio 2017 和 PDFTron 的 C# .NET PDF 庫,適用於 Windows。 Download the library using this link, .NET PDF SDK Download. 初始設定 從.zip 文件提取文件夾。本指南中使用的是 PDFNET_BASE 來選擇提取的文件夾路徑。 // Set the base path where the extracted files are located PDFNET_BASE = "path/to/extraction/folder/PDFNetDotNet4/"; // Set the base path where the extracted files are located PDFNET_BASE = "path/to/extraction/folder/PDFNetDotNet4/"; ' Set the base path where the extracted files are located PDFNET_BASE = "path/to/extraction/folder/PDFNetDotNet4/" $vbLabelText $csharpLabel 運行樣本 導航到提取內容的位置。 查找並進入示例文件夾 (PDFNET_BASE/Samples)。 該文件夾包含 PDFTron SDK 支持的功能的許多示例代碼。 在 Visual Studio 中打開 Samples_20XX.sln。 選擇適合您 Visual Studio 安裝的版本。 Select the sample code and set it as the Startup Project for the solution. 運行該項目。 整合到您的應用程序中 這被稱為“PDFTron Hello World”應用程序。 如果您可以打開、保存和關閉 PDF 文件,那麼整合整個 PDFTron SDK 將會很容易。 在 Visual Studio 中,使用您喜歡的語言創建一個 .NET 框架控制台應用程序項目。 您可以在 Visual C# 或 Visual Basic 類別中找到它們。 進入項目文件夾。 默認情況下,路徑應類似於:C:/Users/User_Name/source/repos/myApp 從 PDFNET_BASE 到您的項目文件夾(該文件夾將有您的 .csproj 或 .vbproj 文件),複製 Lib 文件夾。 在右側找到“解決方案資源管理器”。通過右鍵單擊“引用”選擇“添加引用”選項。 這將打開一個“引用管理器”對話框。 在對話框底部,選擇瀏覽。 導航到複製的 Lib 文件夾以添加 PDFNetLoader.dll 到引用中。 另外,從 x86 文件夾中添加適合的 PDFNet.dll 版本作為另一個引用( path/to/your/project/folder/Lib/PDFNet/x86/PDFNet.dll)。 這將確保應用程序可以在 32 位和 64 位操作系統上運行。 點擊 PDFNet.dll。 確保將其“本地副本”屬性設置為“False”。 class="content-img-align-center"> class="content__image-caption"> 3.2 安裝 IronOCR IronOCR Library 可以通過四種方法安裝。 它們是: 使用 Visual Studio。 使用 Visual Studio 命令行。 從 NuGet 網站直接下載。 從 IronOCR 網站直接下載。 3.2.1 使用 Visual Studio Visual Studio 軟件提供NuGet Package管理器選項,以便將包直接安裝到解決方案中。 屏幕截圖展示了如何打開 NuGet Package Manager。 class="content-img-align-center"> class="content__image-caption"> 這將提供一個搜索框以顯示來自 NuGet 網站的包列表。在包管理器中,我們需要搜索關鍵字“IronOCR”,如下圖所示: class="content-img-align-center"> class="content__image-caption"> 從上圖中,我們可以看到相關搜索結果的列表。 要將包安裝到解決方案中,我們必須選擇所需的選項。 3.2.2 使用 Visual Studio 命令行 在 Visual Studio 中:轉到工具 -> NuGet 包管理器 -> 包管理器控制台 將下面的代碼片段輸入到包管理器控制台選項卡中。 Install-Package IronOcr 現在將包直接安裝到當前項目中,然後可以使用。 3.2.3 從 NuGet 網站直接下載 對於第三種方法,我們可以直接從網站下載 NuGet 包 導航到此 鏈接。 從右側菜單中,確保選擇“下載包”選項。 雙擊下載的包。 它將自動安裝。 接下來,重載解決方案並開始在項目中使用它。 3.2.4 從 IronOCR 網站直接下載 您可以通過點擊此鏈接直接從網站下載最新更新包。 按照提供的說明在下載最新包後添加這個包到項目中。 右鍵單擊解決方案窗格中的項目。 選擇選項引用來瀏覽已下載引用的具體位置。 然後,單擊確定以添加引用。 4.0 OCR 圖像 IronOCR 和 PDFtron OCR 都具有 OCR 技術,可以將圖像轉換為文字尋找。 4.1 使用 PDFTron 將 PDF 轉換為 DOCX、DOC、HTML、SVG、TIFF、PNG、JPEG、XPS、EPUB、TXT 等多種格式。 // Create a new PDF document PDFDoc doc = new PDFDoc("sample.pdf"); // Convert PDF document to SVG Convert.ToSvg(doc, "output.svg"); // Convert PDF document to XPS Convert.ToXps("sample.pdf", "output.xps"); // Convert PDF document to multipage TIFF Convert.TiffOutputOptions tiff_options = new Convert.TiffOutputOptions(); tiff_options.SetDPI(200); tiff_options.SetDither(true); tiff_options.SetMono(true); Convert.ToTiff("sample.pdf", "output.tiff", tiff_options); // Convert PDF to XOD Convert.ToXod("sample.pdf", "output.xod"); // Convert PDF to HTML Convert.ToHtml("sample.pdf", "output.html"); // Create a new PDF document PDFDoc doc = new PDFDoc("sample.pdf"); // Convert PDF document to SVG Convert.ToSvg(doc, "output.svg"); // Convert PDF document to XPS Convert.ToXps("sample.pdf", "output.xps"); // Convert PDF document to multipage TIFF Convert.TiffOutputOptions tiff_options = new Convert.TiffOutputOptions(); tiff_options.SetDPI(200); tiff_options.SetDither(true); tiff_options.SetMono(true); Convert.ToTiff("sample.pdf", "output.tiff", tiff_options); // Convert PDF to XOD Convert.ToXod("sample.pdf", "output.xod"); // Convert PDF to HTML Convert.ToHtml("sample.pdf", "output.html"); ' Create a new PDF document Dim doc As New PDFDoc("sample.pdf") ' Convert PDF document to SVG Convert.ToSvg(doc, "output.svg") ' Convert PDF document to XPS Convert.ToXps("sample.pdf", "output.xps") ' Convert PDF document to multipage TIFF Dim tiff_options As New Convert.TiffOutputOptions() tiff_options.SetDPI(200) tiff_options.SetDither(True) tiff_options.SetMono(True) Convert.ToTiff("sample.pdf", "output.tiff", tiff_options) ' Convert PDF to XOD Convert.ToXod("sample.pdf", "output.xod") ' Convert PDF to HTML Convert.ToHtml("sample.pdf", "output.html") $vbLabelText $csharpLabel 4.2 使用 IronOCR // Create an IronTesseract object var Ocr = new IronTesseract(); Ocr.Language = OcrLanguage.EnglishBest; Ocr.Configuration.TesseractVersion = TesseractVersion.Tesseract5; using (var Input = new OcrInput()) { // Add an image for OCR Input.AddImage(@"3.png"); // Read the text from the image var Result = Ocr.Read(Input); // Print the text to the console Console.WriteLine(Result.Text); Console.ReadKey(); } // Create an IronTesseract object var Ocr = new IronTesseract(); Ocr.Language = OcrLanguage.EnglishBest; Ocr.Configuration.TesseractVersion = TesseractVersion.Tesseract5; using (var Input = new OcrInput()) { // Add an image for OCR Input.AddImage(@"3.png"); // Read the text from the image var Result = Ocr.Read(Input); // Print the text to the console Console.WriteLine(Result.Text); Console.ReadKey(); } ' Create an IronTesseract object Dim Ocr = New IronTesseract() Ocr.Language = OcrLanguage.EnglishBest Ocr.Configuration.TesseractVersion = TesseractVersion.Tesseract5 Using Input = New OcrInput() ' Add an image for OCR Input.AddImage("3.png") ' Read the text from the image Dim Result = Ocr.Read(Input) ' Print the text to the console Console.WriteLine(Result.Text) Console.ReadKey() End Using $vbLabelText $csharpLabel 上述示例已經演示了如何使用 Tesseract 5 API 將圖像文件轉換為可讀文本。 上面的代碼行用於創建 Iron Tesseract 的對象。 此外,為確保我們可以添加一個或多個圖片文件,我們產生了一個 OcrInput 對象,它將需要可用的圖片路徑。 在 Iron Tesseract 對象中,函數“Read”可用於通過解析圖片文件來提取產生的結果到 OCR 結果中獲取圖像。 它可以從照片中提取文本並將其轉換為字符串。 可以使用“AddMultiFrameTiff”方法將多幀圖像添加到 Tesseract 中以完成此過程。 Tesseract 庫將圖像中的每一幀讀取並當作一個單獨的頁面。 在掃描每個幀直到每個幀都成功掃描後才會處理下一幀。 此方法唯一支持的格式是 TIFF 圖像格式。 class="content-img-align-center"> class="content__image-caption"> 上圖顯示了成功將數據轉換為可編輯文本即是 IronOCR 準確性的結果。 5.0 OCR PDF 文件 IronOCR 和 PDFTron OCR 將 PDF 文件轉換為可編輯文本。 PDFTron OCR 為用戶提供一系列選項,例如保存頁面、編輯圖像、識別頁面等。此外,它還可以提供文件、文本、HTML 格式等保存選項。 IronOCR 也允許我們將轉換的 OCR 文件保存為 HTML、文本、PDF 等格式。 5.1 使用 PDFTron OCR 完整的示例代碼顯示了如何使用 PDFTron OCR 以直接、高質量的方式在 PDF、XPS、EMF、SVG、TIFF、PNG、JPEG 和其他圖像格式之間進行轉換。 // Copyright (c) 2001-2021 by PDFTron Systems Inc. All Rights Reserved. using System; using pdftron; using pdftron.Common; using pdftron.Filters; using pdftron.SDF; using pdftron.PDF; // This code demonstrates conversion of documents to formats such as SVG, PDF, EMF, or XPS. namespace ConvertTestCS { class Testfile { public string inputFile, outputFile; public bool requiresWindowsPlatform; public Testfile(string inFile, string outFile, bool requiresWindowsPlatform_) { inputFile = inFile; outputFile = outFile; requiresWindowsPlatform = requiresWindowsPlatform_; } }; class Class1 { private static pdftron.PDFNetLoader pdfNetLoader = pdftron.PDFNetLoader.Instance(); static Class1() {} // Relative paths to the input and output folders. const string inputPath = "../../../../TestFiles/"; const string outputPath = "../../../../TestFiles/Output/"; static bool ConvertSpecificFormats() { bool err = false; try { using (PDFDoc pdfdoc = new PDFDoc()) { // Convert from XPS to PDF Console.WriteLine("Converting from XPS"); pdftron.PDF.Convert.FromXps(pdfdoc, inputPath + "simple-xps.xps"); pdfdoc.Save(outputPath + "xps2pdf v2.pdf", SDFDoc.SaveOptions.e_remove_unused); Console.WriteLine("Saved xps2pdf v2.pdf"); } } catch (PDFNetException e) { Console.WriteLine(e.Message); err = true; } // Other format conversions... return err; } static Boolean ConvertToPdfFromFile() { System.Collections.ArrayList testfiles = new System.Collections.ArrayList(); testfiles.Add(new ConvertTestCS.Testfile("simple-word_2007.docx", "docx2pdf.pdf", false)); // Add other test files... bool err = false; foreach (Testfile file in testfiles) { try { using (pdftron.PDF.PDFDoc pdfdoc = new PDFDoc()) { // Conditions and conversions... pdftron.PDF.Convert.ToPdf(pdfdoc, inputPath + file.inputFile); pdfdoc.Save(outputPath + file.outputFile, SDFDoc.SaveOptions.e_linearized); Console.WriteLine("Converted file: " + file.inputFile); Console.WriteLine("to: " + file.outputFile); } } // Catch exceptions... } return err; } static void Main(string [] args) { PDFNet.Initialize(PDFTronLicense.Key); bool err = false; err = ConvertToPdfFromFile(); if (err) { Console.WriteLine("ConvertFile failed"); } else { Console.WriteLine("ConvertFile succeeded"); } err = ConvertSpecificFormats(); if (err) { Console.WriteLine("ConvertSpecificFormats failed"); } else { Console.WriteLine("ConvertSpecificFormats succeeded"); } // Finalization... PDFNet.Terminate(); Console.WriteLine("Done."); } } } // Copyright (c) 2001-2021 by PDFTron Systems Inc. All Rights Reserved. using System; using pdftron; using pdftron.Common; using pdftron.Filters; using pdftron.SDF; using pdftron.PDF; // This code demonstrates conversion of documents to formats such as SVG, PDF, EMF, or XPS. namespace ConvertTestCS { class Testfile { public string inputFile, outputFile; public bool requiresWindowsPlatform; public Testfile(string inFile, string outFile, bool requiresWindowsPlatform_) { inputFile = inFile; outputFile = outFile; requiresWindowsPlatform = requiresWindowsPlatform_; } }; class Class1 { private static pdftron.PDFNetLoader pdfNetLoader = pdftron.PDFNetLoader.Instance(); static Class1() {} // Relative paths to the input and output folders. const string inputPath = "../../../../TestFiles/"; const string outputPath = "../../../../TestFiles/Output/"; static bool ConvertSpecificFormats() { bool err = false; try { using (PDFDoc pdfdoc = new PDFDoc()) { // Convert from XPS to PDF Console.WriteLine("Converting from XPS"); pdftron.PDF.Convert.FromXps(pdfdoc, inputPath + "simple-xps.xps"); pdfdoc.Save(outputPath + "xps2pdf v2.pdf", SDFDoc.SaveOptions.e_remove_unused); Console.WriteLine("Saved xps2pdf v2.pdf"); } } catch (PDFNetException e) { Console.WriteLine(e.Message); err = true; } // Other format conversions... return err; } static Boolean ConvertToPdfFromFile() { System.Collections.ArrayList testfiles = new System.Collections.ArrayList(); testfiles.Add(new ConvertTestCS.Testfile("simple-word_2007.docx", "docx2pdf.pdf", false)); // Add other test files... bool err = false; foreach (Testfile file in testfiles) { try { using (pdftron.PDF.PDFDoc pdfdoc = new PDFDoc()) { // Conditions and conversions... pdftron.PDF.Convert.ToPdf(pdfdoc, inputPath + file.inputFile); pdfdoc.Save(outputPath + file.outputFile, SDFDoc.SaveOptions.e_linearized); Console.WriteLine("Converted file: " + file.inputFile); Console.WriteLine("to: " + file.outputFile); } } // Catch exceptions... } return err; } static void Main(string [] args) { PDFNet.Initialize(PDFTronLicense.Key); bool err = false; err = ConvertToPdfFromFile(); if (err) { Console.WriteLine("ConvertFile failed"); } else { Console.WriteLine("ConvertFile succeeded"); } err = ConvertSpecificFormats(); if (err) { Console.WriteLine("ConvertSpecificFormats failed"); } else { Console.WriteLine("ConvertSpecificFormats succeeded"); } // Finalization... PDFNet.Terminate(); Console.WriteLine("Done."); } } } ' Copyright (c) 2001-2021 by PDFTron Systems Inc. All Rights Reserved. Imports System Imports pdftron Imports pdftron.Common Imports pdftron.Filters Imports pdftron.SDF Imports pdftron.PDF ' This code demonstrates conversion of documents to formats such as SVG, PDF, EMF, or XPS. Namespace ConvertTestCS Friend Class Testfile Public inputFile, outputFile As String Public requiresWindowsPlatform As Boolean Public Sub New(ByVal inFile As String, ByVal outFile As String, ByVal requiresWindowsPlatform_ As Boolean) inputFile = inFile outputFile = outFile requiresWindowsPlatform = requiresWindowsPlatform_ End Sub End Class Friend Class Class1 Private Shared pdfNetLoader As pdftron.PDFNetLoader = pdftron.PDFNetLoader.Instance() Shared Sub New() End Sub ' Relative paths to the input and output folders. Private Const inputPath As String = "../../../../TestFiles/" Private Const outputPath As String = "../../../../TestFiles/Output/" Private Shared Function ConvertSpecificFormats() As Boolean Dim err As Boolean = False Try Using pdfdoc As New PDFDoc() ' Convert from XPS to PDF Console.WriteLine("Converting from XPS") pdftron.PDF.Convert.FromXps(pdfdoc, inputPath & "simple-xps.xps") pdfdoc.Save(outputPath & "xps2pdf v2.pdf", SDFDoc.SaveOptions.e_remove_unused) Console.WriteLine("Saved xps2pdf v2.pdf") End Using Catch e As PDFNetException Console.WriteLine(e.Message) err = True End Try ' Other format conversions... Return err End Function Private Shared Function ConvertToPdfFromFile() As Boolean Dim testfiles As New System.Collections.ArrayList() testfiles.Add(New ConvertTestCS.Testfile("simple-word_2007.docx", "docx2pdf.pdf", False)) ' Add other test files... Dim err As Boolean = False For Each file As Testfile In testfiles Try Using pdfdoc As pdftron.PDF.PDFDoc = New PDFDoc() ' Conditions and conversions... pdftron.PDF.Convert.ToPdf(pdfdoc, inputPath & file.inputFile) pdfdoc.Save(outputPath & file.outputFile, SDFDoc.SaveOptions.e_linearized) Console.WriteLine("Converted file: " & file.inputFile) Console.WriteLine("to: " & file.outputFile) End Using End Try ' Catch exceptions... Next file Return err End Function Shared Sub Main(ByVal args() As String) PDFNet.Initialize(PDFTronLicense.Key) Dim err As Boolean = False err = ConvertToPdfFromFile() If err Then Console.WriteLine("ConvertFile failed") Else Console.WriteLine("ConvertFile succeeded") End If err = ConvertSpecificFormats() If err Then Console.WriteLine("ConvertSpecificFormats failed") Else Console.WriteLine("ConvertSpecificFormats succeeded") End If ' Finalization... PDFNet.Terminate() Console.WriteLine("Done.") End Sub End Class End Namespace $vbLabelText $csharpLabel 5.2 使用 IronOCR 可以使用 OCRInput 函數完成對 PDF 文件的管理。 文檔中的每一頁將由 Iron Tesseract 類別閱讀。 然後會從頁面提取文本。 名為“AddPDF”的第二個函數允許我們打開受保護的文檔並確保我們可以將 PDF 添加到文檔列表中(如果受保護,則需輸入密碼)。 要打開受密碼保護的 PDF 文檔,請使用以下代碼片段: var Ocr = new IronTesseract(); // Configure nothing using (var Input = new OcrInput()) { // Add PDF with password Input.AddPdf("example.pdf", "password"); var Result = Ocr.Read(Input); Console.WriteLine(Result.Text); } var Ocr = new IronTesseract(); // Configure nothing using (var Input = new OcrInput()) { // Add PDF with password Input.AddPdf("example.pdf", "password"); var Result = Ocr.Read(Input); Console.WriteLine(Result.Text); } Dim Ocr = New IronTesseract() ' Configure nothing Using Input = New OcrInput() ' Add PDF with password Input.AddPdf("example.pdf", "password") Dim Result = Ocr.Read(Input) Console.WriteLine(Result.Text) End Using $vbLabelText $csharpLabel 可以使用“Addpdfpage”函數從 PDF 文件中的一頁閱讀並提取內容。 只需指定要從中提取文字的具體頁碼。 “AddPdfPage”允許您從指定的多頁提取文字。 IEnumerable 允許您高效地指定多個頁面。 您還必須包含文件的位置和擴展名。下面的代碼片段演示了這一點: IEnumerable<int> numbers = new List<int> {2,8,10}; // Create an IronTesseract object var Ocr = new IronTesseract(); using (var Input = new OcrInput()) { // Single page Input.AddPdfPage("example.pdf",10); // Multiple pages Input.AddPdfPages("example.pdf", numbers); var Result = Ocr.Read(Input); Console.WriteLine(Result.Text); // Save result to a text file Result.SaveAsTextFile("ocrtext.txt"); } IEnumerable<int> numbers = new List<int> {2,8,10}; // Create an IronTesseract object var Ocr = new IronTesseract(); using (var Input = new OcrInput()) { // Single page Input.AddPdfPage("example.pdf",10); // Multiple pages Input.AddPdfPages("example.pdf", numbers); var Result = Ocr.Read(Input); Console.WriteLine(Result.Text); // Save result to a text file Result.SaveAsTextFile("ocrtext.txt"); } Dim numbers As IEnumerable(Of Integer) = New List(Of Integer) From {2, 8, 10} ' Create an IronTesseract object Dim Ocr = New IronTesseract() Using Input = New OcrInput() ' Single page Input.AddPdfPage("example.pdf",10) ' Multiple pages Input.AddPdfPages("example.pdf", numbers) Dim Result = Ocr.Read(Input) Console.WriteLine(Result.Text) ' Save result to a text file Result.SaveAsTextFile("ocrtext.txt") End Using $vbLabelText $csharpLabel 使用 SaveAsTextFile 函數將結果直接儲存為文本文件格式,以便您可以直接下載該文件到輸出目錄路徑。 要將文件保存為 HTML 格式,請使用 SaveAsHocrFile。 6.1 使用 PDFTron 我們可以使用 PDFTron SDK 從 PDF 文件中提取圖像,連同它們的位置信息和 DPI。 與其將 PDF 圖像轉換為位圖圖像,您還可以使用 elements.GetImageData() 直接提取未壓縮/壓縮的圖像數據(請參考 PDF 數據提取代碼示例)。 查看更多有關 C# PDF 庫和 PDF 分析和內容提取庫的信息。 6.2 使用 IronOCR IronOCR 有豐富的功能,可讓您直接從掃描的文檔中讀取 QR 碼和條形碼。 下面的代碼片段演示瞭如何從給定的圖像或文檔中掃描條形碼。 // Create an IronTesseract object var Ocr = new IronTesseract(); Ocr.Language = OcrLanguage.EnglishBest; Ocr.Configuration.ReadBarCodes = true; Ocr.Configuration.TesseractVersion = TesseractVersion.Tesseract5; using (var Input = new OcrInput()) { // Add an image with a barcode Input.AddImage("barcode.gif"); // Read the image var Result = Ocr.Read(Input); // Iterate over all barcodes found and display their values foreach (var Barcode in Result.Barcodes) { Console.WriteLine(Barcode.Value); } } // Create an IronTesseract object var Ocr = new IronTesseract(); Ocr.Language = OcrLanguage.EnglishBest; Ocr.Configuration.ReadBarCodes = true; Ocr.Configuration.TesseractVersion = TesseractVersion.Tesseract5; using (var Input = new OcrInput()) { // Add an image with a barcode Input.AddImage("barcode.gif"); // Read the image var Result = Ocr.Read(Input); // Iterate over all barcodes found and display their values foreach (var Barcode in Result.Barcodes) { Console.WriteLine(Barcode.Value); } } ' Create an IronTesseract object Dim Ocr = New IronTesseract() Ocr.Language = OcrLanguage.EnglishBest Ocr.Configuration.ReadBarCodes = True Ocr.Configuration.TesseractVersion = TesseractVersion.Tesseract5 Using Input = New OcrInput() ' Add an image with a barcode Input.AddImage("barcode.gif") ' Read the image Dim Result = Ocr.Read(Input) ' Iterate over all barcodes found and display their values For Each Barcode In Result.Barcodes Console.WriteLine(Barcode.Value) Next Barcode End Using $vbLabelText $csharpLabel 上面代碼有助於從給定的圖像或 PDF 文檔中讀取條形碼。 可以在同一圖像或頁面中同時讀取多個條形碼。 IronOCR 有一種獨特的方法,可以讀取條形碼,Ocr.Configuration.ReadBarCodes。 掃描輸入後,數據儲存在名為 OCRResult 的對象中。 OCRResult 中的屬性名為 Barcodes,將擁有所提供的所有條形碼數據。 我們可以利用 for-each 循環獲取與條形碼詳細信息相關的每個數據。單個過程完成了兩個操作-掃描和讀取條形碼的值。 也支持線程選項,並且可以同時完成多個 OCR 進程。此外,IronOCR 還可以從指定區域識別非常準確的區域。 // Create an IronTesseract object var Ocr = new IronTesseract(); using (var Input = new OcrInput()) { // Define the content area to be scanned var ContentArea = new System.Drawing.Rectangle() { X = 215, Y = 1250, Height = 280, Width = 1335 }; // Add image specifying the content area Input.Add("document.png", ContentArea); // Perform OCR operation var Result = Ocr.Read(Input); // Print the text Console.WriteLine(Result.Text); } // Create an IronTesseract object var Ocr = new IronTesseract(); using (var Input = new OcrInput()) { // Define the content area to be scanned var ContentArea = new System.Drawing.Rectangle() { X = 215, Y = 1250, Height = 280, Width = 1335 }; // Add image specifying the content area Input.Add("document.png", ContentArea); // Perform OCR operation var Result = Ocr.Read(Input); // Print the text Console.WriteLine(Result.Text); } ' Create an IronTesseract object Dim Ocr = New IronTesseract() Using Input = New OcrInput() ' Define the content area to be scanned Dim ContentArea = New System.Drawing.Rectangle() With { .X = 215, .Y = 1250, .Height = 280, .Width = 1335 } ' Add image specifying the content area Input.Add("document.png", ContentArea) ' Perform OCR operation Dim Result = Ocr.Read(Input) ' Print the text Console.WriteLine(Result.Text) End Using $vbLabelText $csharpLabel 上面的代碼片段顯示瞭如何在不同區域執行 OCR。 您只需在 PDF/圖像中指定矩形區域,因為 IronOCR 的 Tesseract 引擎將幫助識別文本。 IronOCR 和 PDFtron OCR 許可模式和定價 IronOCR 許可模式和定價 30 天退款保證: 購買許可證後,您將獲得 30 天退款保證。 在 30 天內,如果您希望退回產品,您將獲得退款。 輕鬆整合: IronOCR 的整合與任何項目和環境如此輕鬆,只需添加作為 NuGet 軟件包的一行代碼即可實現。 另一方面,另一種整合方法是直接從網上下載。 永續許可: 購買的每個許可證不需要更新。 免費支持與產品更新: 每個許可證將直接由產品背後的組提供支持,並將附上一年的免費產品更新。 隨時可以購買擴展。 即時許可證: 一旦收到付款後,註冊許可密鑰將立即寄出。 所有许可证为永久许可证,并适用于开发、测试和生产环境。 Lite 許可證 1 個地點 1 個項目 永久許可 此包允許單個軟件開發人員在單個地點中使用 Iron Software。 此包允許組織中的一名軟件開發人員在一處利用 Iron Software。 Iron Software 可以在單個內聯網應用程序、Web 應用程序或桌面軟件程序中使用。 禁止在組織或代理/客戶關係外共享許可證,因為它們是不可轉讓的。 與所有其他許可證類型一樣,該類型在本協議下明示的所有權利以外的所有權利明確排除在外,無需 OEM 再分發且使 Iron Software 作為 SaaS 使用而不需要額外購買的覆蓋範攬。 定價: 起價$799 每年。 專業許可 10 個地點 10 個項目 這個包允許最多十個軟件開發人員在單個地點中使用 Iron Software,最多十個地點。 此包允許單個軟件開發人員在單個地點中使用 Iron Software。 此許可證允許組織中的一個預定數量的軟件開發人員在多處利用 Iron Software,最多不超過十個。 Iron Software 可以在任意網站、內聯網應用程序或桌面軟件應用程序中使用。許可證是不可轉讓的,且不能在組織或代理/客戶關係外共享。與所有其他許可證類型一樣,該類型在本協議下明示的所有權利以外的所有權利明確排除在外,無需 OEM 再分發且使用 Iron Software 作為 SaaS 除非購買額外的覆蓋範攬。 该许可证可与一个项目集成 ,最多可达 10 个。 價格:從每年 $999 起。 無限許可 無限地點 無限項目 這允許組織中的無限軟件開發人員在無限地點中使用 Iron Software。 此包允許單個軟件開發人員在單個地點中使用 Iron Software。 此許可證允許組織中無限多的軟件開發人員在無限多的地點利用 Iron Software。 Iron Software 可以在任意多個內聯網應用程序、桌面軟件應用程序、或網站中使用。許可證是不可轉讓的,且不能在組織或代理/客戶關係外共享。與所有其他許可證類型一樣,該類型在本協議下明示的所有權利以外的所有權利明確排除在外,包括無需 OEM 再分發且使用 Iron Software 作為 SaaS 除非購買額外的覆蓋範攬。 定價: 起價$4,799 每年。 免版稅再發行 — 允許您多次不同包裝形態的商業產品 (無需支付版稅) 的一部分是基於基礎許可證所覆蓋的項目數量。 這將允許 Iron Software 在 SaaS 軟件服務中部署,這是基於基礎許可證所覆蓋的項目數量。 價格:從每年 $1,599 起。 class="content-img-align-center"> class="content__image-caption"> PDFTron 許可模式和定價 PDFTron 套餐(自定義許可證) 自定義許可證的價格各異 — 獲取適合您特定預算的報價。 部署 PDFTron 的強大文件查看和編輯技术,用於渲染和文件處理於 Web、移動和桌面平台上。 整合準備、OEM 再分發和擁有大量文檔數量或定制需求的組織。 多域定價和優惠的多年折扣。 支持離線和沙盒操作。 自定義、綜合合同條款。 諮詢和培訓服務。 PDFTron 自定義許可證專為滿足您的應用程序和業務需求而定制。 定價取決於您的功能範圍。 class="content-img-align-center"> class="content__image-caption"> IronOCR Lite 許可證是一個未定義的包,包括一名開發者一年支持,約價格在 $799。 IronOCR 專業許可證包括 10 名開發者包和一年支持的價格為 $999,而 PDFTron 包又一次未定義. 要購買包,您必須聯繫支持中心以獲取報價。 IronOCR Lite 和 專業包包括 OEM 或 SaaS 服務和一個 5 年支持選項。 這個 Lite 版本包括一個開發者包和 5 年支持及 Saas 和 OEM 服務費 $2,897 並配有自定義支持選項。 IronOCR 專業版本包含 10 名開發者包及 5 年支持, Saas 和 OEM 服務費用為 $3,397。PDFTron 的 10 名開發者包含一年支持,在 Saas 和 OEM 服務下,價格未定義。 7.0 结论 在 .NET Framework 上下文中的 IronOCR 供應的 Tesseract 提供多種方式使用的照片和 PDF 文件支援,非常容易使用。 它也提供了幾種設置以改進 Tesseract OCR 性能。 支持多種語言,並可在單一操作中容納多種語言。 訪問其網站以了解更多有關 Tesseract OCR 的信息。 PDFTron 是一款使用不同引擎識別圖像和 PDF 文件的軟件應用程序。 它還提供多種設置來改進 OCR 過程的性能,並選擇多種語言的選項。 PDFTron 限制頁面的轉換使用。 不同操作系統也有不同的價錢。 IronOCR 是一款具有競爭力的軟件產品,能比競品提供更高的精確性。 類似產品有時未能識別低質量圖像,結果顯示未知字符。 反之,IronOCR 不僅提供精確的結果,還允許我們識別條形碼數據並從圖像中讀出條形碼的值。 IronOCR 的包以單個價格為所有平台提供競爭性的許可和支持。 相較之下,PDFtron 的 OCR 產品全都專屬自選分配,這通常價格更高。定價在兩者之間有所不同,IronOCR 開始價格為$799,由於自選,PDFtron 的開始價格未定義。 總之,IronOCR 提供更多樣化的功能且價格較低。 你还在等什么? 免费试用对所有人开放。 在此處獲得許可並立即開始! [{i:(PDFTron OCR 是其各自所有者的註冊商標。 本網站與 PDFTron OCR 無關,亦未獲其支持或贊助。 所有產品名稱、徽標和品牌均為其各自所有者的財產。 比較僅供參考,反映撰寫時公開可用的信息。 常見問題解答 什麼是光學字元識別 (OCR) 及其重要性? 光學字元識別 (OCR) 是一種技術,用於將紙張文件或影像轉換為可讀文本。它對於法律、商業和學術領域的應用至關重要,可將掃描檔案和 PDF 轉換回其原始文本格式。 如何將 OCR 功能整合到 C# 應用程式中? 您可以使用 IronOCR 將 OCR 功能整合到 C# 應用程式中,它提供與 .NET 應用程式的無縫整合,並支持多語言和條碼格式。 IronOCR 的安裝步驟有哪些? 可以使用 NuGet Package Manager 通過 Visual Studio 安裝 IronOCR。您還可以使用 Visual Studio 命令行界面,直接從 NuGet 網站下載,或從 IronOCR 網站獲取。 PDFTron OCR 和 IronOCR 之間的主要區別是什麼? 雖然 PDFTron OCR 需要單獨的附加模組並提供文件格式的多樣性,但 IronOCR 提供與 .NET 的更出色整合,支持更多語言,並專注於使用方便與具有競爭力的價格。 IronOCR 如何處理低質量掃描? IronOCR 旨在糾正低質量掃描,即使原始影像的質量不高,也能提供準確的文本識別和結構化數據輸出。 IronOCR 的語言支持能力如何? IronOCR 支持 125 種語言,是全球應用中需要 OCR 功能的靈活選擇。 IronOCR 可以用於條碼識別嗎? 可以,IronOCR 支持從 PDF 和影像中讀取文本以及 QR 代碼和條碼,增強了其在多種應用中的實用性。 OCR 技術的一些常見應用是什麼? OCR 技術通常用於轉換掃描的法律文件、自動化數據輸入、製作 PDF 可搜索,以及通過將文本轉換為音頻來幫助視障用戶。 IronOCR 與 PDFTron OCR 的價格比較如何? IronOCR 提供簡便的永久許可,為不同用戶需求提供選擇,而 PDFTron OCR 的定價則根據具體應用需求定制,通常導致更高成本。 使用 IronOCR 將影像轉換為文本的過程是什麼? 使用 IronOCR,您可以在 .NET 應用程式中利用其 OCR 功能將影像轉換為文本,支持多種影像格式和語言。 Kannapat Udonpant 立即與工程團隊聊天 軟體工程師 在成為软件工程師之前,Kannapat 從日本北海道大學完成了環境資源博士學位。在追逐學位期间,Kannapat 還成為了生產工程系一部份——汽車机器人实验室的成員。2022 年,他利用他的 C# 技能加入 Iron Software 的工程團隊, 專注於 IronPDF。Kannapat 珍惜他的工作,因为他直接向编写大部分 IronPDF 使用的代码的开发者学习。除了同行学习,Kannapat 还喜欢在 Iron Software 工作的社交十环。当他不编写代码或文档时,Kannapat 通常在他的 PS5 上打游戏或重看《The Last of Us》。 相關文章 更新日期 9月 25, 2025 如何在 C# 中選擇最佳 OCR 函式庫 確定專案的最佳光學字符識別(OCR)庫可能具有挑戰性。一些庫專注於企業級OCR功能和高OCR準確度 閱讀更多 更新日期 8月 24, 2025 為什麼 IronOCR 相對於短期記憶模組在光學字符識別中更好:.NET 開發者的實踐指南 光學字符識別(OCR)是從圖像和文檔中提取文本和信息的重要技術。雖然像 GPT-4 和 Gemini 的大型語言模型(LLMs)在自然語言處理方面帶來了革新。 閱讀更多 更新日期 7月 28, 2025 AWS OCR與Azure OCR(OCR功能比較) 這些包括像亞馬遜Web服務(AWS)、微軟Azure和谷歌雲平台上的Google Cloud Vision API等雲提供商 閱讀更多 Tesseract 替代方案(2022 更新)IronOCR 和 Tesseract.NET 之間的...
更新日期 8月 24, 2025 為什麼 IronOCR 相對於短期記憶模組在光學字符識別中更好:.NET 開發者的實踐指南 光學字符識別(OCR)是從圖像和文檔中提取文本和信息的重要技術。雖然像 GPT-4 和 Gemini 的大型語言模型(LLMs)在自然語言處理方面帶來了革新。 閱讀更多
更新日期 7月 28, 2025 AWS OCR與Azure OCR(OCR功能比較) 這些包括像亞馬遜Web服務(AWS)、微軟Azure和谷歌雲平台上的Google Cloud Vision API等雲提供商 閱讀更多