IRONSOFTWAREHOME
Highlight Texts for Debugging
using IronOcr;

IronTesseract ocrTesseract = new IronTesseract();

using var ocrInput = new OcrInput();
ocrInput.LoadPdf("document.pdf");
ocrInput.HighlightTextAndSaveAsImages(ocrTesseract, "highlight_page_", ResultHighlightType.Paragraph);
Imports IronOcr

Dim ocrTesseract As New IronTesseract()

Using ocrInput As New OcrInput()
    ocrInput.LoadPdf("document.pdf")
    ocrInput.HighlightTextAndSaveAsImages(ocrTesseract, "highlight_page_", ResultHighlightType.Paragraph)
End Using
NuGet Download
PM > Install-Package IronOcr
Highlight Texts for Debugging

Highlight Texts for Debugging

IronOCR includes built-in support to visually highlight OCR-detected elements (characters, words, lines, or paragraphs) on images or pages, and export them as PNGs for debugging.

  • OCR-based region detection replaces manual rectangle definitions
  • HighlightTextAndSaveAsImages(ocr, prefix, highlightType) overlays red boxes around detected elements - paragraphs, lines, words, or characters - and saves each page as an image.
  • Uses ResultHighlightType to choose what to highlight: Character, Word, Line, or Paragraph.
  • Handles detection and drawing internally - much simpler than manually specifying rectangle coordinates.

Optional Manual Approach via StampCropRectangles

If you want to manually handle bounding boxes from OCR results:

  • result.Words (or .Lines, .Paragraphs) yields collections whose elements expose X/Y/Width/Height for each detected region.
  • StampCropRectanglesAndSaveAs(...) visualizes those rectangles and writes images to disk
Explore Computer Vision Techniques with IronOCR
View on GitHub

Ready to Get Started?

Nuget Downloads 6,236,385Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required