Class OcrPdfCreator
- Namespace
- SoftZenPdf.Ocr
- Assembly
- SoftZenPdf.Ocr.dll
Turns scanned images into searchable PDFs: each image becomes a page with the recognised text laid invisibly over it, word by word, so it can be searched, selected and copied while the page still looks like the scan.
public sealed class OcrPdfCreator
- Inheritance
-
OcrPdfCreator
- Inherited Members
Examples
using var engine = new TesseractOcrEngine(new TesseractOcrOptions { TessDataPath = "tessdata" });
new OcrPdfCreator(engine).CreatePdf(["invoice_front.jpg", "invoice_back.jpg"], "invoice.pdf");
Constructors
- OcrPdfCreator(IOcrEngine, OcrPdfOptions?)
Creates a converter that recognises text with
engine.
Methods
- AddPage(PdfDocument, PdfImage)
Recognises the text in an image and appends it to
documentas a page with a text layer.
- AddTextLayer(byte[], Stream, string?)
Makes an existing scanned PDF held in memory searchable; see AddTextLayer(string, string, string?).
- AddTextLayer(string, string, string?)
Makes an existing scanned PDF searchable: recognises the largest image on each page and adds the text over it as an incremental update, so the original file, its scans (never re-encoded), bookmarks and metadata are kept byte for byte, and a PDF/A source stays PDF/A.
- CreateDocument(IEnumerable<string>)
Creates a searchable document with a page for each image: one per file, and one per page of a multi-page TIFF.
- CreatePdf(IEnumerable<string>, Stream)
Creates a searchable PDF from images and writes it to a stream.
- CreatePdf(IEnumerable<string>, string)
Creates a searchable PDF from images and saves it.