Class OcrPdfInput
OCR input based on PDF data
Implements
Inherited Members
Namespace: IronOcr
Assembly: IronOcr.dll
Syntax
public class OcrPdfInput : OcrInputBase
Reach for OcrPdfInput to feed a PDF into an OCR read instead of an image. It wraps a PDF, by file path, byte array, stream, or an IDocumentId, so IronTesseract can recognize text across its pages the same way it reads a scan. It is the PDF-specific input alongside the image input types, and as an OcrInputBase it slots into the same Read call every other input uses.
The constructors carry the options a PDF read needs. Each takes the source plus an optional Password for protected documents, a PdfContents value as OcrContent to choose whether to read embedded text, rendered pages, or both, a PageIndices sequence to limit the read to specific pages, and a ContentAreas array of rectangles to restrict recognition to regions of each page. The OcrContent property reports the content mode the input was built with. Because the type implements IDisposable, wrap it in a using so the document and its resources are released after the read.
The input PDFs how-to covers reading from a PDF, and the searchable PDF example turns a read into a searchable document.
Constructors
OcrPdfInput(IDocumentId, PdfContents, IEnumerable<Int32>, Rectangle[])
Create a new OCR input from the specified PDF data.
Specify PdfContents.OnlyImages to OCR individual images within the PDF or PdfContents.TextAndImages to OCR the entire PDF.
Declaration
public OcrPdfInput(IDocumentId Document, PdfContents OcrContent, IEnumerable<int> PageIndices = null, Rectangle[] ContentAreas = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IronSoftware.Abstractions.Pdf.IDocumentId | Document | PDF data |
| PdfContents | OcrContent | OCR individual images within the PDF or OCR the entire PDF |
| System.Collections.Generic.IEnumerable<System.Int32> | PageIndices | PDF pages to OCR |
| IronSoftware.Drawing.Rectangle[] | ContentAreas | Area of each page to OCR (one for EACH page) |
OcrPdfInput(Byte[], String, PdfContents, IEnumerable<Int32>, Rectangle[])
Create a new OCR input from the specified PDF data.
Specify PdfContents.OnlyImages to OCR individual images within the PDF or PdfContents.TextAndImages to OCR the entire PDF.
Declaration
public OcrPdfInput(byte[] Bytes, string Password = null, PdfContents OcrContent, IEnumerable<int> PageIndices = null, Rectangle[] ContentAreas = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | Bytes | PDF data |
| System.String | Password | PDF password |
| PdfContents | OcrContent | OCR individual images within the PDF or OCR the entire PDF |
| System.Collections.Generic.IEnumerable<System.Int32> | PageIndices | PDF pages to OCR |
| IronSoftware.Drawing.Rectangle[] | ContentAreas | Area of each page to OCR (one for EACH page) |
OcrPdfInput(Stream, String, PdfContents, IEnumerable<Int32>, Rectangle[])
Create a new OCR input from the specified PDF stream
Specify PdfContents.OnlyImages to OCR individual images within the PDF or PdfContents.TextAndImages to OCR the entire PDF.
Declaration
public OcrPdfInput(Stream Stream, string Password = null, PdfContents OcrContent, IEnumerable<int> PageIndices = null, Rectangle[] ContentAreas = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | Stream | PDF data stream |
| System.String | Password | PDF password |
| PdfContents | OcrContent | OCR individual images within the PDF or OCR the entire PDF |
| System.Collections.Generic.IEnumerable<System.Int32> | PageIndices | PDF pages to OCR |
| IronSoftware.Drawing.Rectangle[] | ContentAreas | Area of each page to OCR (one for EACH page) |
OcrPdfInput(String, String, PdfContents, IEnumerable<Int32>, Rectangle[])
Create a new OCR input from the specified PDF file
Specify PdfContents.OnlyImages to OCR individual images within the PDF or PdfContents.TextAndImages to OCR the entire PDF.
Declaration
public OcrPdfInput(string Path, string Password = null, PdfContents OcrContent, IEnumerable<int> PageIndices = null, Rectangle[] ContentAreas = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | Path | PDF file path |
| System.String | Password | PDF password |
| PdfContents | OcrContent | OCR individual images within the PDF or OCR the entire PDF |
| System.Collections.Generic.IEnumerable<System.Int32> | PageIndices | PDF pages to OCR |
| IronSoftware.Drawing.Rectangle[] | ContentAreas | Area of each page to OCR (one for EACH page) |
Properties
OcrContent
PDF content; determines what to OCR from within the PDF
Declaration
public PdfContents OcrContent { get; }
Property Value
| Type | Description |
|---|---|
| PdfContents |