Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This Gist contains code snippets regarding conversion of Scanned PDF files to searchable PDF documents
// Get ClientID and ClientSecret from https://dashboard.aspose.cloud/
String clientId = "a41d01ef-dfd5-4e02-ad29-bd85fe41e3e4";
String clientSecret = "d87269aade6a46cdc295b711e26809af";
// createPdfApi instance
PdfApi pdfApi = new PdfApi(clientSecret,clientId);
// input PDF document
String name = "ocrscan.pdf";
// Load the file from local system
File file = new File("/Users/nayyershahbaz/Downloads/" + name);
// upload the file to cloud storage
FilesUploadResult uploadResponse = pdfApi.uploadFile(name, file, null);
// the languages used in image file
String lang = "rus,eng";
// perform the OCR on image PDF document
AsposeResponse response = pdfApi.putSearchableDocument(name, null, null, lang);
assertEquals(200, (int)response.getCode());
This Gist contains code snippets regarding conversion of Scanned PDF files to searchable PDF documents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment