How to extract text from an image file

How to use Iron Tesseract in C#

Iron Tesseract in C# is used by creating an IronTesseract instance, configuring it with language and OCR settings, then calling the Read() method on an OcrInput object containing your images or PDFs. This converts images of text into searchable PDFs using Tesseract 5's optimized engine.

IronOCR provides an intuitive API for utilizing the customized and optimized Tesseract 5, known as Iron Tesseract. By using IronOCR and IronTesseract, you will be able to convert images of text and scanned documents into text and searchable PDFs. The library supports 125 international languages and includes advanced features like barcode reading and computer vision.

Quickstart: Set Up IronTesseract Configuration in C#

This example demonstrates how to configure IronTesseract with specific settings and perform OCR in a single line of code.

Nuget IconGet started making PDFs with NuGet now:

  1. Install IronOCR with NuGet Package Manager

    PM > Install-Package IronOcr

  2. Copy and run this code snippet.

    var result = new IronOcr.IronTesseract { Language = IronOcr.OcrLanguage.English, Configuration = new IronOcr.TesseractConfiguration { ReadBarCodes = false, RenderSearchablePdf = true, WhiteListCharacters = "ABCabc123" } }.Read(new IronOcr.OcrInput("image.png"));
  3. Deploy to test on your live environment

    Start using IronOCR in your project today with a free trial
    arrow pointer

How Do I Create an IronTesseract Instance?

Initialize a Tesseract object with this code:

:path=/static-assets/ocr/content-code-examples/how-to/irontesseract-initialize-irontesseract.cs
using IronOcr;

IronTesseract ocr = new IronTesseract();
$vbLabelText   $csharpLabel

You can customize the behavior of IronTesseract by selecting different languages, enabling barcode reading, and whitelisting/blacklisting characters. IronOCR provides comprehensive configuration options to fine-tune your OCR process:

:path=/static-assets/ocr/content-code-examples/how-to/irontesseract-configure-irontesseract.cs
IronTesseract ocr = new IronTesseract
{
    Configuration = new TesseractConfiguration
    {
        ReadBarCodes = false,
        RenderHocr = true,
        TesseractVariables = null,
        WhiteListCharacters = null,
        BlackListCharacters = "`ë|^",
    },
    MultiThreaded = false,
    Language = OcrLanguage.English,
    EnableTesseractConsoleMessages = true, // False as default
};
$vbLabelText   $csharpLabel

Once configured, you can use Tesseract functionality to read OcrInput objects. The OcrInput class provides flexible methods for loading various input formats:

:path=/static-assets/ocr/content-code-examples/how-to/irontesseract-read.cs
IronTesseract ocr = new IronTesseract();

using OcrInput input = new OcrInput();
input.LoadImage("attachment.png");
OcrResult result = ocr.Read(input);
string text = result.Text;
$vbLabelText   $csharpLabel

For complex scenarios, you can leverage multithreading capabilities to process multiple documents simultaneously, significantly improving performance for batch operations.

What Are the Advanced Tesseract Configuration Variables?

The IronOcr Tesseract interface allows full control of Tesseract configuration variables through the IronOcr.TesseractConfiguration Class. These advanced settings enable you to optimize OCR performance for specific use cases, such as fixing low quality scans or reading specific document types.

How Do I Use Tesseract Configuration in Code?

:path=/static-assets/ocr/content-code-examples/how-to/irontesseract-tesseract-configuration.cs
using IronOcr;
using System;

IronTesseract Ocr = new IronTesseract();

Ocr.Language = OcrLanguage.English;
Ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.AutoOsd;

// Configure Tesseract Engine
Ocr.Configuration.TesseractVariables["tessedit_parallelize"] = false;

using var input = new OcrInput();
input.LoadImage("/path/file.png");

OcrResult Result = Ocr.Read(input);
Console.WriteLine(Result.Text);
$vbLabelText   $csharpLabel

IronOCR also provides specialized configuration for different document types. For instance, when reading passports or processing MICR cheques, you can apply specific preprocessing filters and region detection to improve accuracy.

Example configuration for financial documents:

// Example: Configure for financial documents
IronTesseract ocr = new IronTesseract
{
    Language = OcrLanguage.English,
    Configuration = new TesseractConfiguration
    {
        PageSegmentationMode = TesseractPageSegmentationMode.SingleBlock,
        TesseractVariables = new Dictionary<string, object>
        {
            ["tessedit_char_whitelist"] = "0123456789.$,",
            ["textord_heavy_nr"] = false,
            ["edges_max_children_per_outline"] = 10
        }
    }
};

// Apply preprocessing filters for better accuracy
using OcrInput input = new OcrInput();
input.LoadPdf("financial-document.pdf");
input.Deskew();
input.EnhanceResolution(300);

OcrResult result = ocr.Read(input);
// Example: Configure for financial documents
IronTesseract ocr = new IronTesseract
{
    Language = OcrLanguage.English,
    Configuration = new TesseractConfiguration
    {
        PageSegmentationMode = TesseractPageSegmentationMode.SingleBlock,
        TesseractVariables = new Dictionary<string, object>
        {
            ["tessedit_char_whitelist"] = "0123456789.$,",
            ["textord_heavy_nr"] = false,
            ["edges_max_children_per_outline"] = 10
        }
    }
};

// Apply preprocessing filters for better accuracy
using OcrInput input = new OcrInput();
input.LoadPdf("financial-document.pdf");
input.Deskew();
input.EnhanceResolution(300);

OcrResult result = ocr.Read(input);
$vbLabelText   $csharpLabel

What Is the Complete List of All Tesseract Configuration Variables?

These can be set using IronTesseract.Configuration.TesseractVariables["key"] = value;. The configuration variables allow you to fine-tune OCR behavior for optimal results with your specific documents. For detailed guidance on optimizing OCR performance, refer to our fast OCR configuration guide.

0Use old baseline algorithm0All doc is proportial text0Debug on fixed pitch test0Turn off dp fixed pitch algorithm0Do even faster pitch algorithm0Write full metric stuff0Draw row-level cuts0Draw page-level cuts0Use correct answer for fixed/prop0Attempt whole doc/block fixed pitch0Display separate words0Display separate words0Display forced fixed pitch words0Moan about prop blocks0Moan about fixed pitch blocks0Dump stats when moaning0Do current test0.08Fraction of xheight for sameness0.5Max initial cluster size0.15Min initial cluster spacing0.25Fraction of xheight0.75Fraction of xheight0.6Allowed size variance0.3Non-fuzzy spacing region2.8Min ratio space/nonspace2Min ratio space/nonspace1.5Pitch IQR/Gap IQR threshold0.2Xh fraction noise in pitch0.5Min width of decent blobs0.1Fraction of x to ignore0Debug level for unichar ambiguities0Classify debug level1Normalization Method ...0Matcher Debug Level0Matcher Debug Flags0Learning Debug Level:1Min # of permanent classes3Reliable Config Threshold5Enable adaption even if the ambiguities have not been seen230Threshold for good protos during adaptive 0-255230Threshold for good features during adaptive 0-255229Class Pruner Threshold 0-25515Class Pruner Multiplier 0-255:7Class Pruner CutoffStrength:10Integer Matcher Multiplier 0-255:0Set to 1 for general debug info, to 2 for more details, to 3 to see all the debug messages0Debug level for hyphenated words.2Size of dict word to be treated as non-dict word0Stopper debug level10Max words to keep in list10000Maximum number of different character choices to consider during permutation. This limit is especially useful when user patterns are specified, since overly generic patterns can result in dawg search exploring an overly large number of options.1Fix blobs that aren't chopped0Chop debug10000Split Length2Same distance6Min Number of Points on Outline150Max number of seams in seam_pile-50Min Inside Angle Bend2000Min Outline Area90Width of (smaller) chopped blobs above which we don't care that a chop is not near the center.3X / Y length weight0Debug level for wordrec4Max number of broken pieces to associate0SegSearch debug level2000Maximum number of pain points stored in the queue0Language model debug level8Maximum order of the character ngram model10Maximum number of prunable (those for which PrunablePath() is true) entries in each viterbi list recorded in BLOB_CHOICEs500Maximum size of viterbi lists recorded in BLOB_CHOICEs3Minimum length of compound words0Display Segmentations6Page seg mode: 0=osd only, 1=auto+osd, 2=auto_only, 3=auto, 4=column, 5=block_vert, 6=block, 7=line, 8=word, 9=word_circle, 10=char,11=sparse_text, 12=sparse_text+osd, 13=raw_line (Values from PageSegMode enum in tesseract/publictypes.h)2Which OCR engine(s) to run (Tesseract, LSTM, both). Defaults to loading and running the most accurate available.0Whether to use the top-line splitting process for Devanagari documents while performing page-segmentation.0Whether to use the top-line splitting process for Devanagari documents while performing ocr.0Debug level for BiDi1Debug level0Page number to apply boxes from0Amount of debug output for bigram correction.0Debug reassignment of small outlines8Max diacritics to apply to a blob16Max diacritics to apply to a word0Reestimate debug2alphas in a good word39Adaptation decision algorithm for tess0Print multilang debug info.0Print paragraph debug info.2Only preserve wds longer than this10For adj length in rating per ch1How many potential indicators needed4Don't crunch words with long lower case strings4Don't crunch words with long lower case strings3Crunch words with long repetitions1How many non-noise blbs either side?1What constitues done for spacing0Contextual fixspace debug8Max allowed deviation of blob top outside of font data8Min change in xht before actually trying it0Debug level for sub & superscript fixer85Set JPEG quality level0Specify DPI for input image50Specify minimum characters to try during OSD0Rejection algorithm2Rej blbs near image edge limit8Reject any x-ht lt or eq than this-1-1 -> All pages, else specific page to process1Run in parallel where possible2Allows to include alternative symbols choices in the hOCR output. Valid input values are 0, 1 and 2. 0 is the default value. With 1 the alternative symbol choices per timestep are included. With 2 alternative symbol choices are extracted from the CTC process instead of the lattice. The choices are mapped per character.5Sets the number of cascading iterations for the Beamsearch in lstm_choice_mode. Note that lstm_choice_mode must be set to a value greater than 0 to produce results.0Debug data3or should we use mean10No.samples reqd to reestimate for row40No.gaps reqd with 1 large gap to treat as a table20No.gaps reqd with few cert spaces to use certs1How to avoid being silly7Pixel size of noise0Baseline debug level10Fraction of size for maxima16Transitions for normal blob1super norm blobs to save row0Use ambigs for deciding whether to adapt to a character0Prioritize blob division over chopping1Enable adaptive classifier0Character Normalized Matching0Baseline Normalized Matching1Enable adaptive classifier0Use pre-adapted classifier templates0Save adapted templates to a file0Enable match debugger0Non-linear stroke-density normalization0Bring up graphical debugging windows for fragments training0Use two different windows for debugging the matching: One for the protos and one for the features.0Assume the input is numbers [0-9].1Load system word dawg.1Load frequent word dawg.1Load unambiguous word dawg.1Load dawg with punctuation patterns.1Load dawg with number patterns.1Load dawg with special word bigrams.0Use only the first UTF8 step of the given string when computing log probabilities.0Make AcceptableChoice() always return false. Useful when there is a need to explore all segmentations0Don't use any alphabetic-specific tricks. Set to true in the traineddata config file for scripts that are cursive or inherently fixed-pitch0Save Document Words1Merge the fragments in the ratings matrix and delete them after merging1Associator Enable0force associator to run regardless of what enable_assoc is. This is used for CJK where component grouping is necessary.1Chop enable0Vertical creep1Use new seam_pile0include fixed-pitch heuristics in char segmentation0Only run OCR for words that had truth recorded in BlamerBundle0Print blamer debug messages0Try to set the blame for errors1Save alternative paths found during chopping and segmentation search1Words are delimited by space0Use sigmoidal score for certainty0Take segmentation and labeling from box file0Conversion of word/line box file to char box file0Generate training data from boxed chars0Generate more boxes from boxed chars0Break input into lines and remap boxes if present0Dump intermediate images made during page segmentation1Try inverting the image in LSTMRecognizeWord0Perform training for ambiguities0Generate and print debug information for adaption0Learn both character fragments (as is done in the special low exposure mode) as well as unfragmented characters.0Each bounding box is assumed to contain ngrams. Only learn the ngrams whose outlines overlap horizontally.0Draw output words0Dump char choices0Print timing stats1Try to improve fuzzy spaces0Don't bother with word plausibility1Crunch double hyphens?1Add words to the document dictionary0Output font info per char0Block and Row stats1Enable correction based on the word bigram dictionary.0Enable single word correction based on the dictionary.1Remove and conditionally reassign small outlines when they confuse layout analysis, determining diacritics vs noise0Do minimal rejection on pass 1 output0Test adaption criteria0Test for point1Run paragraph detection on the post-text-recognition (more accurate)1Use ratings matrix/beam search with lstm1Reduce rejection on good docs1Reject spaces?0Add font info to hocr output0Add coordinates for each character to hocr output1Before word crunch?0Take out ~^ early?1As it says1Don't touch sensible strings0Use dictword test1Individual rejection control1Individual rejection control1Individual rejection control0Extend permuter check0Extend permuter check0Output text with boxes0Capture the image from the IPE0Run interactively?1According to dict_word0In multilingual mode use params model of the primary language0Debug line finding0Use CJK fixed pitch model0Allow feature extractors to see the original outline0Only initialize with the config file. Useful if the instance is not going to be used for OCR but say only for layout analysis.0Turn on equation detector1Enable vertical detection0Force using vertical text page mode0Preserve multiple interword spaces1Detect music staff and remove intersecting components0Script has no xheight, so use a single mode0Space stats use prechopping?0Constrain relative values of inter and intra-word gaps for old_to_method.1Block stats to use fixed pitch rows?0Force word breaks on punct to break long lines in non-space delimited langs0Space stats use prechopping?0Fix suspected bug in old code1Only stat OBVIOUS spaces1Only stat OBVIOUS spaces1Only stat OBVIOUS spaces1Only stat OBVIOUS spaces1Use row alone when inadequate cert spaces0Better guess0Pass ANY flip to context?1Don't restrict kn->sp fuzzy limit to tables0Don't remove noise blobs0Display unsorted blobs0Display unsorted blobs1Reject noise-like words1Reject noise-like rows0Debug row garbage detectorClass str to debug learningA filename of user-provided words.A suffix of user-provided words located in tessdata.A filename of user-provided patterns.A suffix of user-provided patterns located in tessdata.Output file for ambiguities found in the dictionaryWord for which stopper debug information should be printed to stdoutBlacklist of chars not to recognizeWhitelist of chars to recognizeList of chars to override tessedit_char_blacklist.expExposure value follows this pattern in the image filename. The name of the image files are expected to be in the form [lang].[fontname].exp [num].tifLeading punctuation).,;:?!1st Trailing punctuation2nd Trailing punctuationPage separator (default is form feed control character)0.2Character Normalization Range ...1.5Veto ratio between classifier ratings5.5Veto difference between classifier certainties0.125Good Match (0-1)0Great Match (0-1)0.02Perfect Match (0-1)0.15Bad Match Pad (0-1)0.1New template margin (0-1)12Avg. noise blob length0.015Maximum angle delta for prototype clustering0Penalty to apply when a non-alnum is vertically out of its expected textline position1.5Rating scaling factor20Certainty scaling factor0.00390625Scale factor for features not used2.5Prune poor adapted results this much worse than best result-1Threshold at which classify_adapted_pruning_factor starts-3Exclude fragments that do not look like whole characters from training and adaption0.3Max large speckle size10Penalty to add to worst rating for noise0.125Score penalty (0.1 = 10%) added if there are subscripts or superscripts in a word, but it is otherwise OK.0.25Score penalty (0.1 = 10%) added if an xheight is inconsistent.1Score multiplier for word matches which have good case and are frequent in the given language (lower is better).1.1Score multiplier for word matches that have good case (lower is better).1.3125Default score multiplier for word matches, which may have case issues (lower is better).1.25Score multiplier for glyph fragment segmentations which do not match a dictionary word (lower is better).-2.25Worst certainty for words that can be inserted into the document dictionary-2.25Good blob limit2Maximum character width-to-height ratio
Tesseract Config VariableDefaultMeaning
classify_num_cp_levels3Number of Class Pruner Levels
textord_debug_tabfind0Debug tab finding
textord_debug_bugs0Turn on output related to bugs in tab finding
textord_testregion_left-1Left edge of debug reporting rectangle
textord_testregion_top-1Top edge of debug reporting rectangle
textord_testregion_right2147483647Right edge of debug rectangle
textord_testregion_bottom2147483647Bottom edge of debug rectangle
textord_tabfind_show_partitions0Show partition bounds, waiting if >1
devanagari_split_debuglevel0Debug level for split shiro-rekha process.
edges_max_children_per_outline10Max number of children inside a character outline
edges_max_children_layers5Max layers of nested children inside a character outline
edges_children_per_grandchild10Importance ratio for chucking outlines
edges_children_count_limit45Max holes allowed in blob
edges_min_nonhole12Min pixels for potential char in box
edges_patharea_ratio40Max lensq/area for acceptable child outline
textord_fp_chop_error2Max allowed bending of chop cells
textord_tabfind_show_images0Show image blobs
textord_skewsmooth_offset4For smooth factor
textord_skewsmooth_offset21For smooth factor
textord_test_x-2147483647coord of test pt
textord_test_y-2147483647coord of test pt
textord_min_blobs_in_row4Min blobs before gradient counted
textord_spline_minblobs8Min blobs in each spline segment
textord_spline_medianwin6Size of window for spline segmentation
textord_max_blob_overlaps4Max number of blobs a big blob can overlap
textord_min_xheight10Min credible pixel xheight
textord_lms_line_trials12Number of linew fits to do
oldbl_holed_losscount10Max lost before fallback line used
pitsync_linear_version6Use new fast algorithm
pitsync_fake_depth1Max advance fake generation
textord_tabfind_show_strokewidths0Show stroke widths
textord_dotmatrix_gap3Max pixel gap for broken pixed pitch
textord_debug_block0Block to do debug on
textord_pitch_range2Max range test on pitch
textord_words_veto_power5Rows required to outvote a veto
equationdetect_save_bi_image0Save input bi image
equationdetect_save_spt_image0Save special character image
equationdetect_save_seed_image0Save the seed image
equationdetect_save_merged_image0Save the merged image
poly_debug0Debug old poly
poly_wide_objects_better1More accurate approx on wide things
wordrec_display_splits0Display splits
textord_debug_printable0Make debug windows printable
textord_space_size_is_variable0If true, word delimiter spaces are assumed to have variable width, even though characters have fixed pitch.
textord_tabfind_show_initial_partitions0Show partition bounds
textord_tabfind_show_reject_blobs0Show blobs rejected as noise
textord_tabfind_show_columns0Show column bounds
textord_tabfind_show_blocks0Show final block bounds
textord_tabfind_find_tables1run table detection
devanagari_split_debugimage0Whether to create a debug image for split shiro-rekha process.
textord_show_fixed_cuts0Draw fixed pitch cell boundaries
edges_use_new_outline_complexity0Use the new outline complexity module
edges_debug0turn on debugging for this module
edges_children_fix0Remove boxy parents of char-like children
gapmap_debug0Say which blocks have tables
gapmap_use_ends0Use large space at start and end of rows
gapmap_no_isolated_quanta0Ensure gaps not less than 2quanta wide
textord_heavy_nr0Vigorously remove noise
textord_show_initial_rows0Display row accumulation
textord_show_parallel_rows0Display page correlated rows
textord_show_expanded_rows0Display rows after expanding
textord_show_final_rows0Display rows after final fitting
textord_show_final_blobsDisplay blob bounds after pre-ass
textord_test_landscape0Tests refer to land/port
textord_parallel_baselines1Force parallel baselines
textord_straight_baselines0Force straight baselines
textord_old_baselines1
textord_old_xheight0Use old xheight algorithm
textord_fix_xheight_bug1Use spline baseline
textord_fix_makerow_bug1Prevent multiple baselines
textord_debug_xheights0Test xheight algorithms
textord_biased_skewcalc1Bias skew estimates with line length
textord_interpolating_skew1Interpolate across gaps
textord_new_initial_xheight1Use test xheight mechanism
textord_debug_blob0Print test blob information
textord_really_old_xheight0Use original wiseowl xheight
textord_oldbl_debug0Debug old baseline generation
textord_debug_baselines0Debug baseline generation
textord_oldbl_paradef1Use para default mechanism
textord_oldbl_split_splines1Split stepped splines
textord_oldbl_merge_parts1Merge suspect partitions
oldbl_corrfix1Improve correlation of heights
oldbl_xhfix0Fix bug in modes threshold for xheights
textord_ocropus_mode0Make baselines for ocropus
textord_tabfind_only_strokewidths0Only run stroke widths
textord_tabfind_show_initialtabs0Show tab candidates
textord_tabfind_show_finaltabs0Show tab vectors
textord_show_tables0Show table regions
textord_tablefind_show_mark0Debug table marking steps in detail
textord_tablefind_show_stats0Show page stats used in table finding
textord_tablefind_recognize_tables0Enables the table recognizer for table layout and filtering.
textord_all_prop
textord_debug_pitch_test
textord_disable_pitch_test
textord_fast_pitch_test
textord_debug_pitch_metric
textord_show_row_cuts
textord_show_page_cuts
textord_pitch_cheat
textord_blockndoc_fixed
textord_show_initial_words
textord_show_new_words
textord_show_fixed_words
textord_blocksall_fixed
textord_blocksall_prop
textord_blocksall_testing
textord_test_mode
textord_pitch_rowsimilarity
words_initial_lower
words_initial_upper
words_default_prop_nonspace
words_default_fixed_space
words_default_fixed_limit
textord_words_definite_spread
textord_spacesize_ratiofp
textord_spacesize_ratioprop
textord_fpiqr_ratio
textord_max_pitch_iqr
textord_fp_min_width
textord_underline_offset
ambigs_debug_level
classify_debug_level
classify_norm_method
matcher_debug_level
matcher_debug_flags
classify_learning_debug_level
matcher_permanent_classes_min
matcher_min_examples_for_ prototyping
matcher_sufficient_examples_ for_prototyping
classify_adapt_proto_threshold
classify_adapt_feature_threshold
classify_class_pruner_threshold
classify_class_pruner_multiplier
classify_cp_cutoff_strength
classify_integer_matcher_multiplier
dawg_debug_level
hyphen_debug_level
stopper_smallword_size
stopper_debug_level
tessedit_truncate_wordchoice_log
max_permuter_attempts
repair_unchopped_blobs
chop_debug
chop_split_length
chop_same_distance
chop_min_outline_points
chop_seam_pile_size
chop_inside_angle
chop_min_outline_area
chop_centered_maxwidth
chop_x_y_weight
wordrec_debug_level
wordrec_max_join_chunks
segsearch_debug_level
segsearch_max_pain_points
segsearch_max_futile_classifications20Maximum number of pain point classifications per chunk that did not result in finding a better word choice.
language_model_debug_level
language_model_ngram_order
language_model_viterbi_list_ max_num_prunable
language_model_viterbi_list_max_size
language_model_min_compound_length
wordrec_display_segmentations
tessedit_pageseg_mode
tessedit_ocr_engine_mode
pageseg_devanagari_split_strategy
ocr_devanagari_split_strategy
bidi_debug
applybox_debug
applybox_page
tessedit_bigram_debug
debug_noise_removal
noise_maxperblob
noise_maxperword
debug_x_ht_level
quality_min_initial_alphas_reqd
tessedit_tess_adaption_mode
multilang_debug_level
paragraph_debug_level
tessedit_preserve_min_wd_len
crunch_rating_max
crunch_pot_indicators
crunch_leave_lc_strings
crunch_leave_uc_strings
crunch_long_repetitions
crunch_debug0As it says
fixsp_non_noise_limit
fixsp_done_mode
debug_fix_space_level
x_ht_acceptance_tolerance
x_ht_min_change
superscript_debug
jpg_quality
user_defined_dpi
min_characters_to_try
suspect_level99Suspect marker level
suspect_short_words2Don't suspect dict wds longer than this
tessedit_reject_mode
tessedit_image_border
min_sane_x_ht_pixels
tessedit_page_number
tessedit_parallelize
lstm_choice_mode
lstm_choice_iterations
tosp_debug_level
tosp_enough_space_samples_for_median
tosp_redo_kern_limit
tosp_few_samples
tosp_short_row
tosp_sanity_method
textord_max_noise_size
textord_baseline_debug
textord_noise_sizefraction
textord_noise_translimit
textord_noise_sncount
use_ambigs_for_adaption
prioritize_division
classify_enable_learning
tess_cn_matching
tess_bn_matching
classify_enable_adaptive_matcher
classify_use_pre_adapted_templates
classify_save_adapted_templates
classify_enable_adaptive_debugger
classify_nonlinear_norm
disable_character_fragments1Do not include character fragments in the results of the classifier
classify_debug_character_fragments
matcher_debug_separate_windows
classify_bln_numeric_mode
load_system_dawg
load_freq_dawg
load_unambig_dawg
load_punc_dawg
load_number_dawg
load_bigram_dawg
use_only_first_uft8_step
stopper_no_acceptable_choices
segment_nonalphabetic_script
save_doc_words
merge_fragments_in_matrix
wordrec_enable_assoc
force_word_assoc
chop_enable
chop_vertical_creep
chop_new_seam_pile
assume_fixed_pitch_char_segment
wordrec_skip_no_truth_words
wordrec_debug_blamer
wordrec_run_blamer
save_alt_choices
language_model_ngram_on0Turn on/off the use of character ngram model
language_model_ngram_use_ only_first_uft8_step0Use only the first UTF8 step of the given string when computing log probabilities.
language_model_ngram_space_ delimited_language
language_model_use_sigmoidal_certainty
tessedit_resegment_from_boxes
tessedit_resegment_from_line_boxes
tessedit_train_from_boxes
tessedit_make_boxes_from_boxes
tessedit_train_line_recognizer
tessedit_dump_pageseg_images
tessedit_do_invert
tessedit_ambigs_training
tessedit_adaption_debug
applybox_learn_chars_and_char_frags_mode
applybox_learn_ngrams_mode
tessedit_display_outwords
tessedit_dump_choices
tessedit_timing_debug
tessedit_fix_fuzzy_spaces
tessedit_unrej_any_wd
tessedit_fix_hyphens
tessedit_enable_doc_dict
tessedit_debug_fonts
tessedit_debug_block_rejection
tessedit_enable_bigram_correction
tessedit_enable_dict_correction
enable_noise_removal
tessedit_minimal_rej_pass1
tessedit_test_adaption
test_pt
paragraph_text_based
lstm_use_matrix
tessedit_good_quality_unrej
tessedit_use_reject_spaces
tessedit_preserve_blk_rej_perfect_wds1Only rej partially rejected words in block rejection
tessedit_preserve_row_rej_perfect_wds1Only rej partially rejected words in row rejection
tessedit_dont_blkrej_good_wds0Use word segmentation quality metric
tessedit_dont_rowrej_good_wds0Use word segmentation quality metric
tessedit_row_rej_good_docs1Apply row rejection to good docs
tessedit_reject_bad_qual_wds1Reject all bad quality wds
tessedit_debug_doc_rejection0Page stats
tessedit_debug_quality_metrics0Output data to debug file
bland_unrej0unrej potential with no checks
unlv_tilde_crunching0Mark v.bad words for tilde crunch
hocr_font_info
hocr_char_boxes
crunch_early_merge_tess_fails
crunch_early_convert_bad_unlv_chs
crunch_terrible_garbage
crunch_leave_ok_strings
crunch_accept_ok1Use acceptability in okstring
crunch_leave_accept_strings0Don't pot crunch sensible strings
crunch_include_numerals0Fiddle alpha figures
tessedit_prefer_joined_punct0Reward punctuation joins
tessedit_write_block_separators0Write block separators in output
tessedit_write_rep_codes0Write repetition char code
tessedit_write_unlv0Write .unlv output file
tessedit_create_txt0Write .txt output file
tessedit_create_hocr0Write .html hOCR output file
tessedit_create_alto0Write .xml ALTO file
tessedit_create_lstmbox0Write .box file for LSTM training
tessedit_create_tsv0Write .tsv output file
tessedit_create_wordstrbox0Write WordStr format .box output file
tessedit_create_pdf0Write .pdf output file
textonly_pdf0Create PDF with only one invisible text layer
suspect_constrain_1Il0UNLV keep 1Il chars rejected
tessedit_minimal_rejection0Only reject tess failures
tessedit_zero_rejection0Don't reject ANYTHING
tessedit_word_for_word0Make output have exactly one word per WERD
tessedit_zero_kelvin_rejection0Don't reject ANYTHING AT ALL
tessedit_rejection_debug0Adaption debug
tessedit_flip_0O1Contextual 0O O0 flips
rej_trust_doc_dawg0Use DOC dawg in 11l conf. detector
rej_1Il_use_dict_word
rej_1Il_trust_permuter_type1Don't double check
rej_use_tess_accepted
rej_use_tess_blanks
rej_use_good_perm
rej_use_sensible_wd
rej_alphas_in_number_perm
tessedit_create_boxfile
tessedit_write_images
interactive_display_mode
tessedit_override_permuter
tessedit_use_primary_params_model
textord_tabfind_show_vlines
textord_use_cjk_fp_model
poly_allow_detailed_fx
tessedit_init_config_only
textord_equation_detect
textord_tabfind_vertical_text
textord_tabfind_force_vertical_text
preserve_interword_spaces
pageseg_apply_music_mask
textord_single_height_mode
tosp_old_to_method
tosp_old_to_constrain_sp_kn
tosp_only_use_prop_rows
tosp_force_wordbreak_on_punct
tosp_use_pre_chopping
tosp_old_to_bug_fix
tosp_block_use_cert_spaces
tosp_row_use_cert_spaces
tosp_narrow_blobs_not_cert
tosp_row_use_cert_spaces1
tosp_recovery_isolated_row_stats
tosp_only_small_gaps_for_kern
tosp_all_flips_fuzzy
tosp_fuzzy_limit_all
textord_no_rejects
textord_show_blobs
textord_show_boxes
textord_noise_rejwords
textord_noise_rejrows
textord_noise_debug
classify_learn_debug_str
user_words_file
user_words_suffix
user_patterns_file
user_patterns_suffix
output_ambig_words_file
word_to_debug
tessedit_char_blacklist
tessedit_char_whitelist
tessedit_char_unblacklist
tessedit_write_params_to_fileWrite all parameters to the given file.
applybox_exposure_pattern
chs_leading_punct('`"
chs_trailing_punct1
chs_trailing_punct2)'`"
outlines_odd%|Non standard number of outlines
outlines_2ij!?%":;Non standard number of outlines
numeric_punctuation.,Punct. chs expected WITHIN numbers
unrecognised_char|Output char for unidentified blobs
ok_repeated_ch_non_alphanum_wds-?*=Allow NN to unrej
conflict_set_I_l_1Il1 []Il1 conflict set
file_type.tifFilename extension
tessedit_load_sublangsList of languages to load with this one
page_separator
classify_char_norm_range
classify_max_rating_ratio
classify_max_certainty_margin
matcher_good_threshold
matcher_reliable_adaptive_result
matcher_perfect_threshold
matcher_bad_match_pad
matcher_rating_margin
matcher_avg_noise_size
matcher_clustering_max_angle_delta
classify_misfit_junk_penalty
rating_scale
certainty_scale
tessedit_class_miss_scale
classify_adapted_pruning_factor
classify_adapted_pruning_threshold
classify_character_fragments_ garbage_certainty_threshold
speckle_large_max_size
speckle_rating_penalty
xheight_penalty_subscripts
xheight_penalty_inconsistent
segment_penalty_dict_frequent_word
segment_penalty_dict_case_ok
segment_penalty_dict_case_bad
segment_penalty_dict_nonword
certainty_scale20Certainty scaling factor
stopper_nondict_certainty_base-2.5Certainty threshold for non-dict words
stopper_phase2_certainty_rejection_offset1Reject certainty offset
stopper_certainty_per_char-0.5Certainty to add for each dict char above small word size.
stopper_allowable_character_badness3Max certaintly variation allowed in a word (in sigma)
doc_dict_pending_threshold0Worst certainty for using pending dictionary
doc_dict_certainty_threshold
tessedit_certainty_threshold
chop_split_dist_knob0.5Split length adjustment
chop_overlap_knob0.9Split overlap adjustment
chop_center_knob0.15Split center adjustment
chop_sharpness_knob0.06Split sharpness adjustment
chop_width_change_knob5Width change adjustment
chop_ok_split100OK split limit
chop_good_split50Good split limit
segsearch_max_char_wh_ratio

For best results, it's recommended to use IronOCR's image preprocessing filters before applying OCR. These filters can dramatically improve accuracy, especially when working with low quality scans or complex documents like tables.

Frequently Asked Questions

How do I configure IronTesseract for OCR in C#?

To configure IronTesseract, create an IronTesseract instance and set properties like Language and Configuration. You can specify the OCR language (from 125 supported languages), enable barcode reading, configure searchable PDF output, and set character whitelisting. For example: var tesseract = new IronOcr.IronTesseract { Language = IronOcr.OcrLanguage.English, Configuration = new IronOcr.TesseractConfiguration { ReadBarCodes = false, RenderSearchablePdf = true } };

What input formats does IronTesseract support?

IronTesseract accepts various input formats through the OcrInput class. You can process images (PNG, JPG, etc.), PDF files, and scanned documents. The OcrInput class provides flexible methods for loading these different formats, making it easy to perform OCR on virtually any document containing text.

Can I read barcodes along with text using IronTesseract?

Yes, IronTesseract includes advanced barcode reading capabilities. You can enable barcode detection by setting ReadBarCodes = true in the TesseractConfiguration. This allows you to extract both text and barcode data from the same document in a single OCR operation.

How do I create searchable PDFs from scanned documents?

IronTesseract can convert scanned documents and images into searchable PDFs by setting RenderSearchablePdf = true in the TesseractConfiguration. This creates PDF files where the text is selectable and searchable, while maintaining the original document appearance.

What languages does IronTesseract support for OCR?

IronTesseract supports 125 international languages for text recognition. You can specify the language by setting the Language property on your IronTesseract instance, such as IronOcr.OcrLanguage.English, Spanish, Chinese, Arabic, and many others.

Can I restrict which characters are recognized during OCR?

Yes, IronTesseract allows character whitelisting and blacklisting through the WhiteListCharacters property in TesseractConfiguration. This feature helps improve accuracy when you know the expected character set, such as limiting recognition to alphanumeric characters only.

How do I perform OCR on multiple documents simultaneously?

IronTesseract supports multithreading capabilities for batch processing. You can leverage parallel processing to OCR multiple documents simultaneously, significantly improving performance when dealing with large volumes of images or PDFs.

What version of Tesseract does IronOCR use?

IronOCR uses a customized and optimized version of Tesseract 5, known as Iron Tesseract. This enhanced engine provides improved accuracy and performance compared to standard Tesseract implementations while maintaining compatibility with .NET applications.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...

Read More
Reviewed by
Jeff Fritz
Jeffrey T. Fritz
Principal Program Manager - .NET Community Team
Jeff is also a Principal Program Manager for the .NET and Visual Studio teams. He is the executive producer of the .NET Conf virtual conference series and hosts 'Fritz and Friends' a live stream for developers that airs twice weekly where he talks tech and writes code together with viewers. Jeff writes workshops, presentations, and plans content for the largest Microsoft developer events including Microsoft Build, Microsoft Ignite, .NET Conf, and the Microsoft MVP Summit
Ready to Get Started?
Nuget Downloads 5,269,558 | Version: 2025.12 just released