Saving recognition results into a stream
Contents
[
Hide
]
You can merge several recognition results into one document using SaveMultipageDocument
method of AsposeOcr
class. This can be useful for recognizing books, contracts, articles, and other printouts consisting of multiple pages, as well as for batch recognition.
The resulting document can be saved into into OutputStream object.
// Initialize Aspose.OCR recognition API
AsposeOCR api = new AsposeOCR();
// Add scanned PDF to the recognition batch
OcrInput source = new OcrInput(InputType.PDF);
source.add("scan.pdf");
// Recognize a document
ArrayList<RecognitionResult> results = api.Recognize(source);
// Create a stream for storing recognition results
OutputStream stream = new ByteArrayOutputStream();
// Save searchable PDF into memory stream
AsposeOCR.SaveMultipageDocument(stream, Format.Pdf, results);