You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While bug fixes continue to be released for Version 3, all breaking changes will be released in Version 4, which is currently under development in the branch named dev/v4. This branch should be usable at present by users eager to use any new features, however there is no guarantee that additional breaking changes will not be implemented. Note that using this branch also requires using the Tesseract.js-core branch dev/v4.
Summary
Breaking Changes
createWorker is now async
In most code this means worker = Tesseract.createWorker() should be replaced with worker = await Tesseract.createWorker()
The third argument to worker.initialize now accepts either (1) an object with key/value pairs or (2) a string containing contents to write to a config file
For example, both of these lines set load_number_dawg to 0:
A single, unified interface has been added for specifying all output formats. output is now the 3rd argument to recognize (see example below). This replaces the separate getPDF function, as well as various setParameters options (tessjs_create_box, tessjs_create_hocr, tessjs_create_osd, tessjs_create_tsv, and tessjs_create_unlv).
Note: the default output formats (text, blocks, hocr, and tsv) are not changing between v3 and v4, so this change only impacts users who want non-default options. This also means that users who want text and pdf outputs only need to specify {pdf: true}, as text is already a default.
Overview
While bug fixes continue to be released for Version 3, all breaking changes will be released in Version 4, which is currently under development in the branch named dev/v4. This branch should be usable at present by users eager to use any new features, however there is no guarantee that additional breaking changes will not be implemented. Note that using this branch also requires using the Tesseract.js-core branch dev/v4.
Summary
Breaking Changes
createWorkeris now asyncworker = Tesseract.createWorker()should be replaced withworker = await Tesseract.createWorker()workerPathorcorePathnow produces error/rejected promise (Rework error reporting from worker threads so all promises resolve #654)worker.loadis no longer needed (createWorkernow returns worker pre-loaded)getPDFfunction replaced bypdfrecognize option (GetPDF() with Scheduler returns the same PDF file #488)Major New Features
imageColor,imageGrey, andimageBinaryoptions (Is it possible to obtain the Thresholded Image from tesseract? #588)rotateAutoandrotateRadianshave been added, which significantly improve accuracy on certain documentsrotateAutooptionworker.setParameters) can now be set for single jobs usingworker.recognizeoptions (Allow for setting parameters for single recognize job when using scheduler #665)worker.recognize(image, {tessedit_char_whitelist: "0123456789"})load_system_dawg,load_number_dawg, andload_punc_dawg) can now be set (Add a way to set "Init Only" parameters (user_word_suffix, etc.) #613)worker.initializenow accepts either (1) an object with key/value pairs or (2) a string containing contents to write to a config fileload_number_dawgto 0:worker.initialize('eng', "0", {load_number_dawg: "0"});worker.initialize('eng', "0", "load_number_dawg 0");Other Changes
loadLanguagenow resolves without error when language is loaded but writing to cache failsdetectreturnsnullvalues when OS detection fails rather than throwing error (Failed to dectet OS #526)Detail
New Output Format Interface
A single, unified interface has been added for specifying all output formats.
outputis now the 3rd argument torecognize(see example below). This replaces the separategetPDFfunction, as well as varioussetParametersoptions (tessjs_create_box,tessjs_create_hocr,tessjs_create_osd,tessjs_create_tsv, andtessjs_create_unlv).Note: the default output formats (
text,blocks,hocr, andtsv) are not changing between v3 and v4, so this change only impacts users who want non-default options. This also means that users who want text and pdf outputs only need to specify{pdf: true}, as text is already a default.