Get OCR Result as file
Contents
[
Hide
]
Get OCR Result as file
Aspose.OCR for .NET provides the class RecognitionResult that contains elements with recognition information and result. To get the result in Document format, you may use the Save method of the RecognitionResult class.
The following code snippet demonstrates the use of the Save method to save the recognition result in file that is generated by the RecognizeImageFromUri method.
Sample Code
...
// For complete examples and data files, please go to https://github.com/aspose-ocr/Aspose.OCR-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_OCR();
// Get image for recognize
string uri = "https://qph.fs.quoracdn.net/main-qimg-0ff82d0dc3543dcd3b06028f5476c2e4";
// Initialize an instance of AsposeOcr
AsposeOcr api = new AsposeOcr();
// Recognize image
RecognitionResult result = api.RecognizeImageFromUri(uri, new RecognitionSettings
{
});
// Save the result in your preferred format
result.Save("D://test.docx", SaveFormat.Docx);
result.Save("D://test.txt", SaveFormat.Text);
result.Save("D://test.pdf", SaveFormat.Pdf);
Select file format for result
Aspose.OCR for .NET provides the option to specify the Document format for result saving. For this, the API provides the SaveFormat enumeration. The SaveFormat enum has the following members.
Member | Description |
---|---|
Text | Saves the document in the plain text format. |
Docx | Saves the document as an Office Open XML WordprocessingML Document (macro-free). |
Saves the document as an PDF (Adobe Portable Document) format. | |
Xlsx | Saves the result as an Excel ( 2007 and later) workbook Document. |