Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active June 22, 2021 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/c5c7178f1826f90504157030c4289ee1 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/c5c7178f1826f90504157030c4289ee1 to your computer and use it in GitHub Desktop.
Convert JPG PNG TIFF BMP image to Searchable Word Document DOC/DOCX using Java
// Initialize an instance of AsposeOcr
AsposeOCR api = new AsposeOCR();
// Instantiate RecognitionSettings class object
RecognitionSettings settings = new RecognitionSettings();
// Recognize image with OCR using RecognizePage method
com.aspose.ocr.RecognitionResult result = api.RecognizePage("sample.png", settings);
// Save the result in Word Document (DOC/DOCX) format with spellcheck
result.saveSpellCheckCorrectedText("Sample_SpellCheck.docx", Format.Docx, SpellCheckLanguage.Eng);
// Initialize an instance of AsposeOcr
AsposeOCR api = new AsposeOCR();
// Instantiate RecognitionSettings class object
RecognitionSettings settings = new RecognitionSettings();
// Recognize input image with RecognizePage method
RecognitionResult result = api.RecognizePage("sample.png", settings);
// Save the result in Microsoft Word Document format
result.save("sample.docx", Format.Docx);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment