using IronOcr;// Create the OCR engine: defaults to English with balanced speed and accuracyIronTesseract ocrTesseract = new IronTesseract();// Required: without this flag the text overlay layer is not built, and SaveAsSearchablePdf produces a plain image PDFocrTesseract.Configuration.RenderSearchablePdf = true;// Wrap the TIFF in OcrImageInput: handles DPI detection and page layout automaticallyusing var imageInput = new OcrImageInput("Potter.tiff");// Run OCR; returns a result containing the recognized text and spatial layout dataOcrResult ocrResult = ocrTesseract.Read(imageInput);// Write the output: the original scanned image is preserved with an invisible text layer on topocrResult.SaveAsSearchablePdf("searchablePdf.pdf");
using IronOcr;
// Create the OCR engine: defaults to English with balanced speed and accuracy
IronTesseract ocrTesseract = new IronTesseract();
// Required: without this flag the text overlay layer is not built, and SaveAsSearchablePdf produces a plain image PDF
ocrTesseract.Configuration.RenderSearchablePdf = true;
// Wrap the TIFF in OcrImageInput: handles DPI detection and page layout automatically
using var imageInput = new OcrImageInput("Potter.tiff");
// Run OCR; returns a result containing the recognized text and spatial layout data
OcrResult ocrResult = ocrTesseract.Read(imageInput);
// Write the output: the original scanned image is preserved with an invisible text layer on top
ocrResult.SaveAsSearchablePdf("searchablePdf.pdf");
ImportsIronOcr' Create the OCR engine: defaults to English with balanced speed and accuracyDim ocrTesseract As New IronTesseract()' Required: without this flag the text overlay layer is not built, and SaveAsSearchablePdf produces a plain image PDFocrTesseract.Configuration.RenderSearchablePdf = True' Wrap the TIFF in OcrImageInput: handles DPI detection and page layout automaticallyUsing imageInput As New OcrImageInput("Potter.tiff") ' Run OCR; returns a result containing the recognized text and spatial layout data Dim ocrResult AsOcrResult = ocrTesseract.Read(imageInput) ' Write the output: the original scanned image is preserved with an invisible text layer on top ocrResult.SaveAsSearchablePdf("searchablePdf.pdf")EndUsing
Imports IronOcr
' Create the OCR engine: defaults to English with balanced speed and accuracy
Dim ocrTesseract As New IronTesseract()
' Required: without this flag the text overlay layer is not built, and SaveAsSearchablePdf produces a plain image PDF
ocrTesseract.Configuration.RenderSearchablePdf = True
' Wrap the TIFF in OcrImageInput: handles DPI detection and page layout automatically
Using imageInput As New OcrImageInput("Potter.tiff")
' Run OCR; returns a result containing the recognized text and spatial layout data
Dim ocrResult As OcrResult = ocrTesseract.Read(imageInput)
' Write the output: the original scanned image is preserved with an invisible text layer on top
ocrResult.SaveAsSearchablePdf("searchablePdf.pdf")
End Using
输出
searchablePdf.pdf:可搜索的 PDF 输出文件。请选中或搜索任意单词,以验证 OCR 文本层。
生成的 PDF 文件将原始扫描的页面图像嵌入其中,并在每个识别出的单词上方叠加了一层不可见的文本层。 在查看器中选择或搜索任意WORD,以确认文本图层是否存在。
photo.png:通过 ReadPhoto 并使用增强型模型加载的墙面壁画照片,用于生成可搜索的 PDF 文件。
using IronOcr;var ocr = new IronTesseract();using var input = new OcrInput();input.LoadImage("photo.png");// ReadPhoto with Enhanced modelOcrPhotoResult photoResult = ocr.ReadPhoto(input, ModelType.Enhanced);Console.WriteLine(photoResult.Text);// Save as searchable PDFbyte[] pdfBytes = photoResult.SaveAsSearchablePdfBytes();File.WriteAllBytes("searchable-photo.pdf", pdfBytes);
using IronOcr;
var ocr = new IronTesseract();
using var input = new OcrInput();
input.LoadImage("photo.png");
// ReadPhoto with Enhanced model
OcrPhotoResult photoResult = ocr.ReadPhoto(input, ModelType.Enhanced);
Console.WriteLine(photoResult.Text);
// Save as searchable PDF
byte[] pdfBytes = photoResult.SaveAsSearchablePdfBytes();
File.WriteAllBytes("searchable-photo.pdf", pdfBytes);
C#
输出
searchable-photo.pdf:由 ReadPhoto 生成的可搜索 PDF。其文本层支持在任何 PDF 阅读器中进行全文搜索。
生成的可搜索 PDF 文件会在识别出的文字上方叠加一层不可见的文本层。 在 PDF 阅读器中搜索"Milk"会返回 3 个匹配结果,这些结果直接提取自原始照片中的手写文本。
using IronOcr;var ocr = new IronTesseract();using var input = new OcrInput();input.LoadImage("invoice.png");// ReadDocumentAdvanced with Enhanced modelOcrDocAdvancedResult docResult = ocr.ReadDocumentAdvanced(input, ModelType.Enhanced);byte[] docPdfBytes = docResult.SaveAsSearchablePdfBytes();File.WriteAllBytes("searchable-doc.pdf", docPdfBytes);
using IronOcr;
var ocr = new IronTesseract();
using var input = new OcrInput();
input.LoadImage("invoice.png");
// ReadDocumentAdvanced with Enhanced model
OcrDocAdvancedResult docResult = ocr.ReadDocumentAdvanced(input, ModelType.Enhanced);
byte[] docPdfBytes = docResult.SaveAsSearchablePdfBytes();
File.WriteAllBytes("searchable-doc.pdf", docPdfBytes);
在处理多页文档的 PDF OCR 操作时,IronOCR 会按顺序处理每一页,并保持原始文档的结构。
输入
通过OcrPdfInput加载的11页Hartwell Capital Management年度报告。 使用Read调用中处理这些页面。
multi-page-scan.pdf:一份 11 页的 Hartwell Capital Management 年报,用作多页可搜索 PDF 转换的输入文件。
using IronOcr;// Create the OCR engine. RenderSearchablePdf is false by default; no need to set it when using OcrPdfInput directlyvar ocrTesseract = new IronTesseract();// Load pages 1–10 (indices 0–9) only; PageIndices avoids loading and OCR-ing the full document unnecessarilyusing var pdfInput = new OcrPdfInput("multi-page-scan.pdf", PageIndices: Enumerable.Range(0, 10));// Run OCR across all selected pages in orderOcrResult result = ocrTesseract.Read(pdfInput);// Write the searchable PDF; true = apply the input's image filters to the embedded page images in the outputresult.SaveAsSearchablePdf("searchable-multi-page.pdf", true);
using IronOcr;
// Create the OCR engine. RenderSearchablePdf is false by default; no need to set it when using OcrPdfInput directly
var ocrTesseract = new IronTesseract();
// Load pages 1–10 (indices 0–9) only; PageIndices avoids loading and OCR-ing the full document unnecessarily
using var pdfInput = new OcrPdfInput("multi-page-scan.pdf", PageIndices: Enumerable.Range(0, 10));
// Run OCR across all selected pages in order
OcrResult result = ocrTesseract.Read(pdfInput);
// Write the searchable PDF; true = apply the input's image filters to the embedded page images in the output
result.SaveAsSearchablePdf("searchable-multi-page.pdf", true);
ImportsIronOcr' Create the OCR engine. RenderSearchablePdf is false by default; no need to set it when using OcrPdfInput directlyDim ocrTesseract As New IronTesseract()' Load pages 1–10 (indices 0–9) only; PageIndices avoids loading and OCR-ing the full document unnecessarilyUsing pdfInput As New OcrPdfInput("multi-page-scan.pdf", PageIndices:=Enumerable.Range(0, 10)) ' Run OCR across all selected pages in order Dim result AsOcrResult = ocrTesseract.Read(pdfInput) ' Write the searchable PDF; true = apply the input's image filters to the embedded page images in the output result.SaveAsSearchablePdf("searchable-multi-page.pdf", True)EndUsing
Imports IronOcr
' Create the OCR engine. RenderSearchablePdf is false by default; no need to set it when using OcrPdfInput directly
Dim ocrTesseract As New IronTesseract()
' Load pages 1–10 (indices 0–9) only; PageIndices avoids loading and OCR-ing the full document unnecessarily
Using pdfInput As New OcrPdfInput("multi-page-scan.pdf", PageIndices:=Enumerable.Range(0, 10))
' Run OCR across all selected pages in order
Dim result As OcrResult = ocrTesseract.Read(pdfInput)
' Write the searchable PDF; true = apply the input's image filters to the embedded page images in the output
result.SaveAsSearchablePdf("searchable-multi-page.pdf", True)
End Using
输出
searchable-multi-page.pdf:10 页的可搜索 PDF 输出文件。每页均包含一个用于全文搜索的不可见文本图层。
生成的 PDF 文件共 10 页(源自原始报告的第 1–10 页),每页均包含一个不可见的文本图层,使提取的内容可在任何 PDF 阅读器中被选中并进行搜索。
using IronOcr;// Create OCR engine: filters are applied at the OcrInput level, so no configuration changes are needed herevar ocr = new IronTesseract();var ocrInput = new OcrInput();// Load the scanned PDF as the OCR sourceocrInput.LoadPdf("invoice.pdf");// Convert to grayscale: removes color noise that can reduce OCR accuracy on color-printed documentsocrInput.ToGrayScale();// Run OCR on the preprocessed inputOcrResult result = ocr.Read(ocrInput);// Write the searchable PDF; true = embed the grayscale-filtered image rather than the original color scanresult.SaveAsSearchablePdf("outputGrayscale.pdf", true);
using IronOcr;
// Create OCR engine: filters are applied at the OcrInput level, so no configuration changes are needed here
var ocr = new IronTesseract();
var ocrInput = new OcrInput();
// Load the scanned PDF as the OCR source
ocrInput.LoadPdf("invoice.pdf");
// Convert to grayscale: removes color noise that can reduce OCR accuracy on color-printed documents
ocrInput.ToGrayScale();
// Run OCR on the preprocessed input
OcrResult result = ocr.Read(ocrInput);
// Write the searchable PDF; true = embed the grayscale-filtered image rather than the original color scan
result.SaveAsSearchablePdf("outputGrayscale.pdf", true);
ImportsIronOcr' Create OCR engine: filters are applied at the OcrInput level, so no configuration changes are needed hereDim ocr As New IronTesseract()Dim ocrInput As New OcrInput()' Load the scanned PDF as the OCR sourceocrInput.LoadPdf("invoice.pdf")' Convert to grayscale: removes color noise that can reduce OCR accuracy on color-printed documentsocrInput.ToGrayScale()' Run OCR on the preprocessed inputDim result AsOcrResult = ocr.Read(ocrInput)' Write the searchable PDF; True = embed the grayscale-filtered image rather than the original color scanresult.SaveAsSearchablePdf("outputGrayscale.pdf", True)
Imports IronOcr
' Create OCR engine: filters are applied at the OcrInput level, so no configuration changes are needed here
Dim ocr As New IronTesseract()
Dim ocrInput As New OcrInput()
' Load the scanned PDF as the OCR source
ocrInput.LoadPdf("invoice.pdf")
' Convert to grayscale: removes color noise that can reduce OCR accuracy on color-printed documents
ocrInput.ToGrayScale()
' Run OCR on the preprocessed input
Dim result As OcrResult = ocr.Read(ocrInput)
' Write the searchable PDF; True = embed the grayscale-filtered image rather than the original color scan
result.SaveAsSearchablePdf("outputGrayscale.pdf", True)
如果 PDF 中的文本在视觉上显示正确,但在搜索或复制时显示损坏的字符,则该问题是由可搜索文本层中使用的默认字体引起的。 默认情况下,SaveAsSearchablePdf使用Times New Roman,但该字体不完全支持所有Unicode字符。 这会影响包含重音字符或非 ASCII 字符的语言。
// Return as a byte array: suited for storing in a database or sending in an HTTP response bodybyte[] pdfByte = ocrResult.SaveAsSearchablePdfBytes();// Return as a stream: suited for uploading to cloud storage or piping to another I/O operation without buffering the full fileStream pdfStream = ocrResult.SaveAsSearchablePdfStream();
// Return as a byte array: suited for storing in a database or sending in an HTTP response body
byte[] pdfByte = ocrResult.SaveAsSearchablePdfBytes();
// Return as a stream: suited for uploading to cloud storage or piping to another I/O operation without buffering the full file
Stream pdfStream = ocrResult.SaveAsSearchablePdfStream();
' Return as a byte array: suited for storing in a database or sending in an HTTP response bodyDim pdfByte AsByte() = ocrResult.SaveAsSearchablePdfBytes()' Return as a stream: suited for uploading to cloud storage or piping to another I/O operation without buffering the full fileDim pdfStream AsStream = ocrResult.SaveAsSearchablePdfStream()
' Return as a byte array: suited for storing in a database or sending in an HTTP response body
Dim pdfByte As Byte() = ocrResult.SaveAsSearchablePdfBytes()
' Return as a stream: suited for uploading to cloud storage or piping to another I/O operation without buffering the full file
Dim pdfStream As Stream = ocrResult.SaveAsSearchablePdfStream()
using IronOcr;using System.IO;public class SearchablePdfExporter{ public async TaskProcessAndUploadPdf(string inputPath) { var ocr = new IronTesseract {Configuration = { RenderSearchablePdf = true } }; // Process the input using var input = new OcrImageInput(inputPath); var result = ocr.Read(input); // Option 1: Save to database as byte array byte[] pdfBytes = result.SaveAsSearchablePdfBytes(); // Store pdfBytes in database BLOB field // Option 2: Upload to cloud storage using stream using (Stream pdfStream = result.SaveAsSearchablePdfStream()) { // Upload stream to Azure Blob Storage, AWS S3, etc. awaitUploadToCloudStorage(pdfStream, "searchable-output.pdf"); } // Option 3: Return as web response // return File(pdfBytes, "application/pdf", "searchable.pdf"); } private async TaskUploadToCloudStorage(Stream stream, string fileName) { // Cloud upload implementation }}
using IronOcr;
using System.IO;
public class SearchablePdfExporter
{
public async Task ProcessAndUploadPdf(string inputPath)
{
var ocr = new IronTesseract
{
Configuration = { RenderSearchablePdf = true }
};
// Process the input
using var input = new OcrImageInput(inputPath);
var result = ocr.Read(input);
// Option 1: Save to database as byte array
byte[] pdfBytes = result.SaveAsSearchablePdfBytes();
// Store pdfBytes in database BLOB field
// Option 2: Upload to cloud storage using stream
using (Stream pdfStream = result.SaveAsSearchablePdfStream())
{
// Upload stream to Azure Blob Storage, AWS S3, etc.
await UploadToCloudStorage(pdfStream, "searchable-output.pdf");
}
// Option 3: Return as web response
// return File(pdfBytes, "application/pdf", "searchable.pdf");
}
private async Task UploadToCloudStorage(Stream stream, string fileName)
{
// Cloud upload implementation
}
}
ImportsIronOcrImportsSystem.IOPublic Class SearchablePdfExporter PublicAsync Function ProcessAndUploadPdf(inputPath AsString) AsTask Dim ocr As New IronTesseractWith { .Configuration = { .RenderSearchablePdf = True } } ' Process the inputUsing input As New OcrImageInput(inputPath) Dim result = ocr.Read(input) ' Option 1: Save to database as byte array Dim pdfBytes AsByte() = result.SaveAsSearchablePdfBytes() ' Store pdfBytes in database BLOB field ' Option 2: Upload to cloud storage using streamUsing pdfStream AsStream = result.SaveAsSearchablePdfStream() ' Upload stream to Azure Blob Storage, AWS S3, etc.AwaitUploadToCloudStorage(pdfStream, "searchable-output.pdf")EndUsing ' Option 3: Return as web response ' Return File(pdfBytes, "application/pdf", "searchable.pdf")EndUsing End Function PrivateAsync Function UploadToCloudStorage(stream AsStream, fileName AsString) AsTask ' Cloud upload implementation End FunctionEnd Class
Imports IronOcr
Imports System.IO
Public Class SearchablePdfExporter
Public Async Function ProcessAndUploadPdf(inputPath As String) As Task
Dim ocr As New IronTesseract With {
.Configuration = { .RenderSearchablePdf = True }
}
' Process the input
Using input As New OcrImageInput(inputPath)
Dim result = ocr.Read(input)
' Option 1: Save to database as byte array
Dim pdfBytes As Byte() = result.SaveAsSearchablePdfBytes()
' Store pdfBytes in database BLOB field
' Option 2: Upload to cloud storage using stream
Using pdfStream As Stream = result.SaveAsSearchablePdfStream()
' Upload stream to Azure Blob Storage, AWS S3, etc.
Await UploadToCloudStorage(pdfStream, "searchable-output.pdf")
End Using
' Option 3: Return as web response
' Return File(pdfBytes, "application/pdf", "searchable.pdf")
End Using
End Function
Private Async Function UploadToCloudStorage(stream As Stream, fileName As String) As Task
' Cloud upload implementation
End Function
End Class
using IronOcr;using System.Threading.Tasks;using System.Collections.Concurrent;public class BatchPdfProcessor{ private readonly IronTesseract _ocr; publicBatchPdfProcessor() { _ocr = new IronTesseract {Configuration = {RenderSearchablePdf = true, // Configure for optimal performanceLanguage = OcrLanguage.English } }; } public async TaskProcessBatchAsync(string[] filePaths) { var results = new ConcurrentBag<(string source, string output)>(); awaitParallel.ForEachAsync(filePaths, async (filePath, ct) => { using var input = new OcrImageInput(filePath); var result = _ocr.Read(input); string outputPath = Path.ChangeExtension(filePath, ".searchable.pdf"); result.SaveAsSearchablePdf(outputPath); results.Add((filePath, outputPath)); });Console.WriteLine($"Processed {results.Count} files"); }}
using IronOcr;
using System.Threading.Tasks;
using System.Collections.Concurrent;
public class BatchPdfProcessor
{
private readonly IronTesseract _ocr;
public BatchPdfProcessor()
{
_ocr = new IronTesseract
{
Configuration =
{
RenderSearchablePdf = true,
// Configure for optimal performance
Language = OcrLanguage.English
}
};
}
public async Task ProcessBatchAsync(string[] filePaths)
{
var results = new ConcurrentBag<(string source, string output)>();
await Parallel.ForEachAsync(filePaths, async (filePath, ct) =>
{
using var input = new OcrImageInput(filePath);
var result = _ocr.Read(input);
string outputPath = Path.ChangeExtension(filePath, ".searchable.pdf");
result.SaveAsSearchablePdf(outputPath);
results.Add((filePath, outputPath));
});
Console.WriteLine($"Processed {results.Count} files");
}
}
ImportsIronOcrImportsSystem.Threading.TasksImportsSystem.Collections.ConcurrentPublic Class BatchPdfProcessor PrivateReadOnly _ocr AsIronTesseract Public Sub New() _ocr = New IronTesseractWith { .Configuration = { .RenderSearchablePdf = True, ' Configure for optimal performance .Language = OcrLanguage.English } } End Sub PublicAsync Function ProcessBatchAsync(filePaths AsString()) AsTask Dim results As New ConcurrentBag(Of (source AsString, output AsString))()AwaitTask.Run(Sub()Parallel.ForEach(filePaths, Sub(filePath)Using input As New OcrImageInput(filePath) Dim result = _ocr.Read(input) Dim outputPath AsString = Path.ChangeExtension(filePath, ".searchable.pdf") result.SaveAsSearchablePdf(outputPath) results.Add((filePath, outputPath))EndUsing End Sub) End Function)Console.WriteLine($"Processed {results.Count} files") End FunctionEnd Class
Imports IronOcr
Imports System.Threading.Tasks
Imports System.Collections.Concurrent
Public Class BatchPdfProcessor
Private ReadOnly _ocr As IronTesseract
Public Sub New()
_ocr = New IronTesseract With {
.Configuration = {
.RenderSearchablePdf = True,
' Configure for optimal performance
.Language = OcrLanguage.English
}
}
End Sub
Public Async Function ProcessBatchAsync(filePaths As String()) As Task
Dim results As New ConcurrentBag(Of (source As String, output As String))()
Await Task.Run(Sub()
Parallel.ForEach(filePaths,
Sub(filePath)
Using input As New OcrImageInput(filePath)
Dim result = _ocr.Read(input)
Dim outputPath As String = Path.ChangeExtension(filePath, ".searchable.pdf")
result.SaveAsSearchablePdf(outputPath)
results.Add((filePath, outputPath))
End Using
End Sub)
End Function)
Console.WriteLine($"Processed {results.Count} files")
End Function
End Class
var advancedOcr = new IronTesseract{Configuration = {RenderSearchablePdf = true,TesseractVariables = new Dictionary<string, object> { { "preserve_interword_spaces", 1 }, { "tessedit_char_whitelist", "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" } },PageSegmentationMode = TesseractPageSegmentationMode.SingleColumn },Language = OcrLanguage.EnglishBest};
var advancedOcr = new IronTesseract
{
Configuration =
{
RenderSearchablePdf = true,
TesseractVariables = new Dictionary<string, object>
{
{ "preserve_interword_spaces", 1 },
{ "tessedit_char_whitelist", "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" }
},
PageSegmentationMode = TesseractPageSegmentationMode.SingleColumn
},
Language = OcrLanguage.EnglishBest
};
ImportsIronOcrDim advancedOcr As New IronTesseractWith { .Configuration = New TesseractConfigurationWith { .RenderSearchablePdf = True, .TesseractVariables = New Dictionary(OfString, Object) From { {"preserve_interword_spaces", 1}, {"tessedit_char_whitelist", "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"} }, .PageSegmentationMode = TesseractPageSegmentationMode.SingleColumn }, .Language = OcrLanguage.EnglishBest}
Imports IronOcr
Dim advancedOcr As New IronTesseract With {
.Configuration = New TesseractConfiguration With {
.RenderSearchablePdf = True,
.TesseractVariables = New Dictionary(Of String, Object) From {
{"preserve_interword_spaces", 1},
{"tessedit_char_whitelist", "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"}
},
.PageSegmentationMode = TesseractPageSegmentationMode.SingleColumn
},
.Language = OcrLanguage.EnglishBest
}
这些配置选项同样适用于所有三种输出方法:SaveAsSearchablePdfStream。 下方的摘要汇总了所有可搜索的 PDF 处理方法及其对应的输出格式。
摘要
using IronOCR 创建可搜索 PDF 既简单又灵活。 无论是需要通过ReadDocumentAdvanced进行高级文档扫描,该库均提供强大的方法来生成各种格式的可搜索PDF。 使用ModelType参数选择标准和增强ML模型之间的准确性。 以文件、字节或流的形式导出的功能使其能够适应从桌面应用程序到基于云的服务等任何应用程序架构。
using IronOCR 创建可搜索 PDF 只需一行代码即可完成: new IronOcr.IronTesseract { Configuration = { RenderSearchablePdf = true }.}.Read(new IronOcr.OcrImageInput("file.jpg")).SaveAsSearchablePdf("searchable.pdf").这展示了 IronOCR 简化的 API 设计。
在可搜索 PDF 中,不可见文本层是如何工作的?
IronOCR 会自动将识别出的文本作为不可见图层定位在 PDF 原始图像之上。这确保了文本与图像的精确映射,使用户能够在保持原始文档视觉外观的同时,对文本进行选择和搜索。IronOCR库通过专用字体和定位算法来实现这一功能。
我能将照片或屏幕截图转换为可搜索的 PDF 文件吗?
是的,ReadPhoto、ReadScreenShot 和 ReadDocumentAdvanced 的处理结果均支持 SaveAsSearchablePdf 功能。每个方法返回的结果类型均支持可搜索 PDF 导出,从而能够轻松地将真实照片、屏幕截图或复杂的文档扫描件转换为可搜索的 PDF 文件。
出现这种情况是因为可搜索文本层使用的默认字体(Times New Roman)无法完全支持所有 Unicode 字符。要解决此问题,请将兼容 Unicode 的字体文件作为 SaveAsSearchablePdf 的第三个参数传入。如果您的文档最初使用 Times New Roman 排版,且发现与其他字体存在间距不一致的情况,请尝试使用 Liberation Serif,因为它具有相同的字形度量,并能保留原始布局。
What advanced configuration options are available in IronOCR for creating searchable PDFs?
IronOCR offers advanced configuration options, including detailed Tesseract configuration, setting Tesseract variables, and choosing different page segmentation modes. These can be tailored to fine-tune OCR for specific document types or languages.