與其他組件的比較 IronOCR 和 PDFTRON OCR 之間的比較 Kannapat Udonpant 更新:7月 28, 2025 下載 IronOCR NuGet 下載 DLL 下載 Windows 安裝程式 開始免費試用 法學碩士副本 法學碩士副本 將頁面複製為 Markdown 格式,用於 LLMs 在 ChatGPT 中打開 請向 ChatGPT 諮詢此頁面 在雙子座打開 請向 Gemini 詢問此頁面 在雙子座打開 請向 Gemini 詢問此頁面 打開困惑 向 Perplexity 詢問有關此頁面的信息 分享 在 Facebook 上分享 分享到 X(Twitter) 在 LinkedIn 上分享 複製連結 電子郵件文章 OCR是"光學字元辨識"的縮寫。 這是將紙本文件或圖像轉換為可讀文字的過程。 實現這一目標的方法有很多種,例如掃描或透過鍵盤手動輸入。 這樣做是為了將所有掃描文件和 PDF 文件轉換為其原始文字格式。 事實證明,這種方法在刑事案件中非常有價值,因為文件損壞嚴重,無法進行人工轉錄,但可以透過 OCR 軟體進行掃描和解讀。 隨著技術的進步和數位工具的普及,OCR 也被應用於其他領域,例如 Google Docs 等應用程式上的文件轉換,以及學術界和商業領域。 OCR主要分為兩種:"靜態"和"動態"。 最常見的類型是靜態 OCR,即一次性掃描整個文件。 而動態 OCR 則一次掃描一行,可以處理更複雜的佈局,例如表格資料。 本文將探討兩種最受歡迎的 OCR 和 PDF 應用程式及文件庫之間的比較。 這些工具包括 PDFTron OCR IronOCR 1.0 引言 1.1 PDFTron OCR 簡介及功能 要將 OCR 與 PDFTron SDK 結合使用,我們需要安裝一個單獨的 OCR 模組插件實用程式。 這有助於SDK從文件中檢測文字。 它可以讓文字可選中和可搜尋。 PDFTron SDK 支援最多 100 種語言。 PDFTron OCR 引擎由 Tesseract 的開源 LSTM 神經網路提供支援。 PDFTron OCR 支援多種影像格式的文字偵測。 OCR 也接受僅包含光柵影像的 PDF 文件,輸出品質取決於輸入影像。 用於 OCR 的最佳影像是解析度為 300 DPI 的灰階影像。 PDFTron OCR 的功能特性 使列印文件中的影像可搜尋。 將普通PDF轉換為可搜尋的PDF。 從商業文件中偵測重要資訊。 讓書籍掃描更方便。 從車輛影像中偵測車牌號碼。 幫助視障使用者。 使用 OCR 技術可以輕鬆地從文件中對多個文件進行資料輸入。 輕鬆將名片資訊轉移到聯絡人資料清單中。 1.2 IronOCR — 簡介與特點 Iron Software 為軟體工程師提供 IronOCR for .NET,用於在 .NET 應用程式和網站中讀取照片和 PDF 中的文字內容。 該軟體可協助掃描照片中的文字和條碼,支援多種世界語言,並以純文字或結構化資料的形式輸出。 Iron Software 的 OCR 程式庫可用於 Web、控制台、MVC 和眾多 .NET 桌面應用程式。 對於商業部署,除了購買許可證外,開發團隊還會提供直接協助。 IronOCR 使用最新的 Tesseract 5 引擎,可以讀取任何 PDF 格式的文字、二維碼和條碼。 使用此程式庫將 OCR 新增至桌面、Web 應用程式和控制台可確保快速整合。 IronOCR 支援 125 種國際語言。 它還支援自訂語言和詞表。 IronOCR 可以讀取 20 多種條碼和二維碼格式。 支援多頁 GIF 和 TIFF 影像格式。 校正低品質掃描件和影像。 支援多執行緒。 它可以同時執行一個或多個進程。 IronOCR 可以提供結構化資料輸出,例如頁面、段落、行、單字、字元等。 IronOCR 支援 Windows、Linux、macOS 等作業系統。 2. 在 Visual Studio 中建立新項目 開啟 Visual Studio 並找到"檔案"選單。 選擇新建項目,然後選擇控制台應用程式。 在本文中,我們將使用控制台應用程式來產生 PDF 文件。 在適當的文字方塊中輸入專案名稱並選擇檔案路徑。 然後,點擊"創建"按鈕。 此外,請選擇所需的 .NET Framework。 Visual Studio 專案現在會產生所選應用程式的結構。 專案結構現在將由 Visual Studio 產生。 如果您選擇了 Windows、控制台和 Web 應用程序,則會開啟 program.cs 文件,以便您可以輸入程式碼並建置/運行您的應用程式。 下一步,我們需要新增庫來測試程式碼。 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 的免費整合試用版,在 Windows 上的 .NET Framework 應用程式中執行 PDFTron 範例。 免費試用版包含解決方案工程師的支援和無限次試用使用。 先決條件 Visual Studio:請確保.NET Desktop Development和.NET Framework 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 運行樣本 導航至提取內容所在的位置。 找到並進入 Samples 資料夾(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 Framework 控制台應用程式專案。 您可以在 Visual C# 或 Visual Basic 類別下找到它們。 進入你的專案資料夾。 預設情況下,路徑應類似於:C:/Users/使用者名稱/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。 3.2 安裝 IronOCR IronOCR庫可以透過四種方式安裝。 這些工具包括 使用 Visual Studio。 使用 Visual Studio Command-Line。 直接從 NuGet 網站下載。 直接從 IronOCR 網站下載。 3.2.1 使用 Visual Studio Visual Studio 軟體提供 NuGet 套件管理員選項,可直接將套件安裝至解決方案。 螢幕截圖示範如何開啟 NuGet 套件管理器。 這將提供一個搜尋框,用於顯示 NuGet 網站上的套件清單。在套件管理器中,我們需要搜尋關鍵字"IronOCR",如下面的螢幕截圖所示: 從上圖我們可以看到相關的搜尋結果清單。 要將軟體包安裝到解決方案中,我們必須選擇所需的選項。 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 物件中,可以使用"讀取"功能,透過解析圖片檔案並將產生的結果提取到 OCR 結果中來獲取影像。 它可以從照片中提取文字並將其轉換為字串。 Tesseract 可用於透過" AddMultiFrameTiff "方法新增多幀影像。 Tesseract 圖書館會將圖像中的每一幀都視為一個獨立的頁面進行讀取和處理。 讀取影像的每一幀後,才會繼續讀取下一幀,直到每一幀都成功掃描為止。 此方法僅支援 TIFF 影像格式。 上圖顯示了資料成功轉換為可編輯文字的結果,這得益於 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 檔案的管理。 鐵超立方體類別會讀取文件中的每一頁。 然後,文字將從頁面中提取出來。 第二個功能"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 影像轉換為 Bitmap 之外,您還可以使用 elements.GetImageData() 直接提取未壓縮/壓縮的影像資料(在 PDF 資料擷取程式碼範例中進行了描述)。 了解更多關於我們的 C# PDF 庫和 PDF 解析與內容提取庫的資訊。 6.2 使用 IronOCR IronOCR 具有大量令人印象深刻的功能,可讓您直接從掃描文件中讀取二維碼和條碼。 下面的程式碼片段示範如何掃描給定影像或文件中的條碼。 // 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 迴圈來取得與條碼詳細資訊相關的每個個體資料。在一個過程中完成兩個操作-掃描和讀取條碼的值。 IronOCR也支援執行緒選項,並可同時完成多個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包添加,即可用一行程式碼完成整合。 另一方面,整合環境的另一種方法是直接從網路上下載。 永久授權:購買的每個許可證均無需續期。 免費支援和產品更新:每個許可證都將獲得產品背後的團隊的直接支持,並附帶一年的免費產品更新。 您可以隨時購買擴充功能。 立即發放許可證:收到付款後,註冊的許可證密鑰將立即發送。 所有許可均為永久性許可,適用於開發、測試和製作。 精簡版許可證 1 位開發人員 1 個地點 1 個項目 永久許可 此套件可讓組織中的單一軟體開發人員在同一地點使用 Iron Software。 Iron Software 可以在單一的內部網路應用程式、網路應用程式或桌面軟體程式中使用。 由於授權不可轉讓,因此禁止在組織或代理/客戶關係之外共用授權。 本許可證類型與所有其他許可證類型一樣,明確排除所有未根據本協議明確授予的權利,但不包括 OEM 再發行和在未購買額外保險的情況下將 Iron Software 作為 SaaS 使用。 定價:每年從$799起。 專業執照 10 位開發人員 10 個地點 10 個項目 永久許可 此許可證允許組織中預定數量的軟體開發人員在眾多地點使用 Iron Software,最多不超過 10 人。 Iron Software 可用於任意數量的網站、內網應用程式或桌面軟體應用程式。許可證不可轉讓,且不得在組織或代理/客戶關係之外共享。與其他所有授權類型一樣,此授權類型明確排除本協議未明確授予的所有權利,包括 OEM 再分發以及在未購買額外服務的情況下將 Iron Software 作為 SaaS 使用。 此授權可與單一專案整合,最多可整合 10 個專案。 定價:每年 $999 起。 無限制許可 無限開發者 地點不限 項目數量不限 永久許可 此授權允許組織內無限數量的軟體開發人員在無限數量的地點使用 Iron Software。 Iron Software 可隨意用於內部網路應用程式、桌上型軟體應用程式或網站。許可證不可轉讓,也不可在組織或代理/客戶關係之外共用。本許可證類型與所有其他許可證類型一樣,明確排除本協議未授予的所有權利,包括 OEM 再發行和在未購買額外保險的情況下將 Iron Software 作為 SaaS 使用。 定價:每年$4,799起價。 免版稅再分發— 這允許您根據基本許可證涵蓋的項目數量,將 Iron 軟體作為幾個不同包裝的商業產品的一部分進行分發(無需支付版稅)。 這將允許在 SaaS 軟體服務內部署 Iron Software,這是根據基本授權所涵蓋的專案數量而定。 定價:每年 $1,599 起。 PDFTron 授權模式和定價 PDFTron軟體套件(自訂許可證) 客製化授權的價格各不相同-請取得符合您具體預算的報價。 在 Web、行動和桌面平台上部署 PDFTron 強大的文件檢視和編輯技術,用於渲染和處理文檔 適用於整合、OEM 再分發,以及擁有大量文件或特殊需求的組織 多網域定價和優惠的多年度折扣 支援離線和沙盒操作 客製化、全面的合約條款 諮詢和培訓服務 PDFTron 客製化授權可根據您的應用程式和業務需求量身打造。 定價取決於您的功能範圍。 IronOCR Lite許可證是一個未定義的軟體包,包含一名開發人員和一年的支持,價格約為$799 。 IronOCR專業版授權包含 10 個開發者軟體包和一年的支援費用為 $999,而 PDFTron 軟體包則未定義。 如需購買套餐,請聯絡客服中心以取得報價。 IronOCR Lite和Professional套餐包含 OEM 或 SaaS 服務,並提供 5 年支援選項。 Lite版本包含一個開發者套餐,提供 5 年支持,SaaS 和 OEM 服務費用為 2,897 美元,並提供客製化支援選項。 IronOCR專業版包含 10 個開發人員軟體包,提供 5 年支援、SaaS 和 OEM 服務,售價 3,397 美元。 PDFTron 的 10 個開發人員軟體包提供 1 年支援、SaaS 和 OEM 服務,但價格尚未確定。 7.0 結論 IronOCR 在 .NET Framework 環境中提供了 Tesseract,它使用起來非常簡單,支援以多種方式取得的照片和 PDF 文件。 它還提供了幾個用於提高 Tesseract OCR 性能的設定。 支援多種語言,並且能夠在一次操作中使用多種語言。 請造訪他們的網站,以了解更多關於 Tesseract OCR 的資訊。 PDFTron 是一款使用不同引擎識別影像和 PDF 文件的軟體應用程式。 它還提供了各種設定來提高 OCR 過程的效能,並可以選擇多種語言。 PDFTron 在頁面轉換的使用上有一些限制。 它還針對不同的作業系統提供不同的價格。 IronOCR 是一款具有競爭力的軟體產品,其準確度比其他同類產品更高。 類似產品有時無法辨識低品質影像,導致顯示未知字元。 另一方面,IronOCR 不僅能提供準確的結果,還能辨識條碼資料並從影像中讀取條碼的值。 IronOCR 套餐以統一的價格為所有平台提供具有競爭力的許可和支援。 相比之下,PDFTron 的所有 OCR 產品均為客製化選擇,價格往往更高。兩款產品的定價有所不同,IronOCR 的起價為$799 ,而由於 PDFTron 採用客製化選擇,其起價未定。 總之,IronOCR 以更低的價格提供了更廣泛的功能。 所以你還在等什麼? 免費試用對所有人開放。 點擊此處取得許可證,立即開始使用! 請注意PDFTron OCR 為其各自所有者的註冊商標。 本網站與 PDFTron OCR 無任何關聯,也未獲得其認可或贊助。 所有產品名稱、標誌和品牌均為其各自擁有者的財產。 比較資料僅供參考,並反映撰寫時的公開資訊。 常見問題解答 什麼是光學字元識別 (OCR) 及其重要性? 光學字元識別 (OCR) 是一種用於將紙張文件或影像轉換為可讀取文字的技術。它對法律、商業和學術領域的應用至關重要,可將掃描檔案和 PDF 轉換為原始文字格式。 如何將 OCR 功能整合到 C# 應用程式中? 您可以使用 IronOCR 將 OCR 功能整合到 C# 應用程式中,IronOCR 提供與 .NET 應用程式的無縫整合,並支援多種語言和條碼格式。 IronOCR 的安裝步驟是什麼? IronOCR 可使用 NuGet Package Manager 透過 Visual Studio 安裝。您也可以使用 Visual Studio Command-Line、直接從 NuGet 網站下載,或從 IronOCR 網站取得。 PDFTron OCR 與 IronOCR 的主要差異為何? PDFTron OCR 需要一個單獨的附加模組,並提供文件格式的多樣性,而 IronOCR 則提供與 .NET 優異的整合性、支援更多的語言,並提供有競爭力的價格,且著重於易用性。 IronOCR 如何處理低品質掃描? IronOCR 旨在修正低品質掃描,即使原始影像品質不高,也能提供精確的文字辨識和結構化資料輸出。 IronOCR 有哪些語言支援能力? IronOCR 支援 125 種語言,是需要 OCR 功能的全球應用程式的多用途選擇。 IronOCR 可以用於 BarCode 識別嗎? 是的,IronOCR 不僅支援讀取文字,還支援讀取 PDF 和圖像中的 QR 代碼和 BarCode,增強了其在各種應用程式中的實用性。 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》。 相關文章 發表日期 12月 18, 2025 適用於 Windows 10 的最佳 OCR 軟體:完整比較指南 [2025] 瞭解適用於 Windows 10 的最佳 OCR 軟體。 閱讀更多 發表日期 12月 11, 2025 Tesseract OCR PDF to Text C#:開發人員與 IronOCR 的比較 了解如何使用 Tesseract OCR 和 IronOCR 將 PDF 輕鬆轉換為文字。 閱讀更多 發表日期 12月 11, 2025 使用 Tesseract C# vs IronOCR:在 .NET 中實現 OCR 的完整指南 學習如何有效率地使用 Tesseract C# 和 IronOCR 進行光學字元識別。 閱讀更多 Tesseract 替代方案(2022 更新)IronOCR 和 Tesseract.NET 之間的...
發表日期 12月 11, 2025 Tesseract OCR PDF to Text C#:開發人員與 IronOCR 的比較 了解如何使用 Tesseract OCR 和 IronOCR 將 PDF 輕鬆轉換為文字。 閱讀更多
發表日期 12月 11, 2025 使用 Tesseract C# vs IronOCR:在 .NET 中實現 OCR 的完整指南 學習如何有效率地使用 Tesseract C# 和 IronOCR 進行光學字元識別。 閱讀更多