Class ImageToSearchablePdf
- Namespace
- LMKit.Document.Conversion
- Assembly
- LM-Kit.NET.dll
Converts an image to a searchable PDF (PDF/OCR) by placing the original image as the visible layer and overlaying invisible, selectable text from OCR results. The output PDF supports text selection, copy, and full-text search while preserving the original image appearance.
public static class ImageToSearchablePdf
- Inheritance
-
ImageToSearchablePdf
- Inherited Members
Examples
Example: Convert a scanned image to a searchable PDF using LM-Kit OCR.
using LMKit.Document.Conversion;
using LMKit.Extraction.Ocr;
var ocr = new LMKitOcr();
ImageToSearchablePdf.Convert("scan.png", ocr, "output.pdf");
Methods
- Convert(ImageBuffer, PageElement, string, PdfGenerationOptions)
Converts an in-memory ImageBuffer to a searchable PDF using a PageElement that contains positioned text elements.
- Convert(ImageBuffer, OcrEngine, string, PdfGenerationOptions, CancellationToken)
Converts an in-memory ImageBuffer to a searchable PDF synchronously. Runs OCR on the image buffer, then builds the PDF.
- Convert(ImageBuffer, OcrResult, string, PdfGenerationOptions)
Converts an in-memory ImageBuffer to a searchable PDF using a precomputed OcrResult.
- Convert(string, PageElement, string, PdfGenerationOptions)
Converts an image file to a searchable PDF using a PageElement that contains positioned text elements. This overload is useful when text layout comes from a source other than OcrResult.
- Convert(string, OcrEngine, string, PdfGenerationOptions, CancellationToken)
Converts an image file to a searchable PDF synchronously. Runs OCR on the image, then builds a PDF with the image layer and an invisible text overlay for search and selection.
- Convert(string, OcrResult, string, PdfGenerationOptions)
Converts an image file to a searchable PDF using a precomputed OcrResult. Useful when OCR has already been performed and results are cached.
- ConvertAsync(ImageBuffer, PageElement, string, PdfGenerationOptions)
Asynchronous version of Convert(ImageBuffer, PageElement, string, PdfGenerationOptions). Converts an in-memory ImageBuffer to a searchable PDF using a PageElement.
- ConvertAsync(ImageBuffer, OcrEngine, string, PdfGenerationOptions, CancellationToken)
Converts an in-memory ImageBuffer to a searchable PDF asynchronously. Runs OCR on the image buffer, then builds the PDF.
- ConvertAsync(ImageBuffer, OcrResult, string, PdfGenerationOptions)
Asynchronous version of Convert(ImageBuffer, OcrResult, string, PdfGenerationOptions). Converts an in-memory ImageBuffer to a searchable PDF using a precomputed OcrResult.
- ConvertAsync(string, PageElement, string, PdfGenerationOptions)
Asynchronous version of Convert(string, PageElement, string, PdfGenerationOptions). Converts an image file to a searchable PDF using a PageElement.
- ConvertAsync(string, OcrEngine, string, PdfGenerationOptions, CancellationToken)
Converts an image file to a searchable PDF asynchronously. Runs OCR on the image, then builds a PDF with the image layer and an invisible text overlay for search and selection.
- ConvertAsync(string, OcrResult, string, PdfGenerationOptions)
Asynchronous version of Convert(string, OcrResult, string, PdfGenerationOptions). Converts an image file to a searchable PDF using a precomputed OcrResult.