diff --git a/Classical-Components-Demo/Droid/Classical-Components-Demo.Droid.csproj b/Classical-Components-Demo/Droid/Classical-Components-Demo.Droid.csproj
index a57838d..10cf1f9 100644
--- a/Classical-Components-Demo/Droid/Classical-Components-Demo.Droid.csproj
+++ b/Classical-Components-Demo/Droid/Classical-Components-Demo.Droid.csproj
@@ -158,7 +158,7 @@
- 4.2.0
+ 4.2.1-alpha.2
diff --git a/Classical-Components-Demo/Droid/MainActivity.cs b/Classical-Components-Demo/Droid/MainActivity.cs
index 70080f7..e54217f 100644
--- a/Classical-Components-Demo/Droid/MainActivity.cs
+++ b/Classical-Components-Demo/Droid/MainActivity.cs
@@ -66,8 +66,9 @@ protected override void OnCreate(Bundle savedInstanceState)
AssignApplyImageFilterButtonHandler();
AssignImportImageButtonHandler();
AssignCreatePdfButtonHandler();
- AssignCreateTiffButtonHandler();
AssignOcrButtonsHandler();
+ AssignCreateSandwichPdfButtonHandler();
+ AssignCreateTiffButtonHandler();
AssignCheckRecognizerUiButtonHandler();
PermissionUtils.Request(this, FindViewById(Resource.Layout.Main));
@@ -185,14 +186,26 @@ void AssignCreatePdfButtonHandler()
DebugLog("Starting PDF creation...");
- Task.Run(() =>
+ Task.Run(async () =>
{
try
{
- var pdfOutputUri = GenerateRandomFileUrlInDemoTempStorage(".pdf");
- var images = new AndroidNetUri[] { documentImageUri }; // add more images for PDF pages here
- // The SDK call is sync!
- SBSDK.CreatePDF(images, pdfOutputUri, PDFPageSize.A4);
+ var inputUris = new AndroidNetUri[] { documentImageUri }; // add more images for PDF pages here
+ var pdfOutputUri = await SBSDK.CreatePDF(inputUris,
+ new PDFConfiguration
+ {
+ PageOrientation = PDFPageOrientation.Auto,
+ PageSize = PDFPageSize.A4,
+ PdfAttributes = new PDFAttributes
+ {
+ Author = "Scanbot User",
+ Creator = "ScanbotSDK",
+ Title = "ScanbotSDK PDF",
+ Subject = "Generating a sandwiched PDF",
+ Keywords = new[] { "x-platform", "ios", "android" },
+ }
+ });
+
DebugLog("PDF file created: " + pdfOutputUri);
ShowAlertDialog("PDF file created: " + pdfOutputUri, onDismiss: () =>
{
@@ -255,17 +268,22 @@ void AssignOcrButtonsHandler()
Task.Run(() => {
try
{
- var pdfOutputUri = GenerateRandomFileUrlInDemoTempStorage(".pdf");
- var images = new AndroidNetUri[] { documentImageUri }; // add more images for OCR here
+ var inputUris = new AndroidNetUri[] { documentImageUri }; // add more images for OCR here
// The SDK call is sync!
- var result = SBSDK.PerformOCR(images, SBSDK.GetOcrConfigs(), pdfOutputUri);
- DebugLog("Recognized OCR text: " + result.RecognizedText);
- DebugLog("Sandwiched PDF file created: " + pdfOutputUri);
- ShowAlertDialog(result.RecognizedText, "OCR Result", () =>
- {
- OpenSharingDialog(pdfOutputUri, "application/pdf");
- });
+ // NOTE:
+ // The default OCR engine is 'OcrConfig.ScanbotOCR' which is ML based. This mode doesn't expect the Langauges array.
+ // If you wish to use the previous engine please use 'OcrConfig.Tesseract(...)'. The Languages array is mandatory in this mode.
+ // Uncomment the below code to use the past legacy 'OcrConfig.Tesseract(...)' engine mode.
+ // var ocrConfig = OcrConfig.Tesseract(withLanguageString: new List{ "en", "de" });
+
+ // Using the default OCR option
+ var ocrConfig = OcrConfig.ScanbotOCR;
+
+ var ocrResult = SBSDK.PerformOCR(inputUris, ocrConfig);
+
+ DebugLog("Recognized OCR text: " + ocrResult.RecognizedText);
+ ShowAlertDialog(ocrResult.RecognizedText, "OCR Result", () => { });
}
catch (Exception e)
{
@@ -282,6 +300,61 @@ void AssignOcrButtonsHandler()
};
}
+ private void AssignCreateSandwichPdfButtonHandler()
+ {
+ var createSandwichPdfButton = FindViewById