@@ -5,14 +5,18 @@ import android.content.Context
55import android.net.Uri
66import android.util.Log
77import androidx.core.net.toFile
8- import io.scanbot.pdf.model.*
98import io.scanbot.sdk.*
109import io.scanbot.sdk.docprocessing.Document
1110import io.scanbot.sdk.entity.*
1211import io.scanbot.sdk.ocr.*
1312import io.scanbot.sdk.ocr.intelligence.*
14- import io.scanbot.sdk.ocr.model.*
1513import io.scanbot.sdk.ocr.process.*
14+ import io.scanbot.sdk.pdfgeneration.PageDirection
15+ import io.scanbot.sdk.pdfgeneration.PageFit
16+ import io.scanbot.sdk.pdfgeneration.PageSize
17+ import io.scanbot.sdk.pdfgeneration.PdfAttributes
18+ import io.scanbot.sdk.pdfgeneration.PdfConfiguration
19+ import io.scanbot.sdk.pdfgeneration.ResamplingMethod
1620
1721/*
1822 NOTE: this snippet of code is to be used only as a part of the website documentation.
@@ -38,7 +42,7 @@ fun initSdkSnippet(application: Application, licenseKey: String) {
3842fun createOcrEngine (context : Context ) {
3943 // @Tag("Create OCR Engine")
4044 val scanbotSDK = ScanbotSDK (context)
41- val ocrRecognizer = scanbotSDK.createOcrEngine ()
45+ val ocrEngine = scanbotSDK.createOcrEngineExtension ()
4246 // @EndTag("Create OCR Engine")
4347}
4448
@@ -53,29 +57,29 @@ fun enableBinarizationInOcrSettingsSnippet(application: Application) {
5357
5458fun engineModeTesseractSnippet (context : Context ) {
5559 // @Tag("Engine Mode Tesseract")
56- val ocrRecognizer = ScanbotSDK (context).createOcrEngine ()
60+ val ocrRecognizer = ScanbotSDK (context).createOcrEngineExtension ()
5761
5862 val languages = mutableSetOf<Language >()
5963 languages.add(Language .ENG )
6064
6165 ocrRecognizer.setOcrConfig(
62- OcrEngine .OcrConfig (
63- engineMode = OcrEngine .EngineMode .TESSERACT ,
66+ OcrEngineExtension .OcrConfig (
67+ engineMode = OcrEngineExtension .EngineMode .TESSERACT ,
6468 languages = languages,
6569 )
6670 )
6771 // @EndTag("Engine Mode Tesseract")
6872}
6973
70- fun runOcrOnUrisSnippet (ocrEngine : OcrEngine ) {
74+ fun runOcrOnUrisSnippet (ocrEngine : OcrEngineExtension ) {
7175 // @Tag("Run OCR from images")
7276 val imageFileUris: List <Uri > = listOf () // ["file:///some/path/file1.jpg", "file:///some/path/file2.jpg", ...]
7377
7478 var result: OcrResult = ocrEngine.recognizeFromUris(imageFileUris, false )
7579 // @EndTag("Run OCR from images")
7680}
7781
78- fun runOcrOnDocumentSnippet (ocrEngine : OcrEngine , yourDocument : Document ) {
82+ fun runOcrOnDocumentSnippet (ocrEngine : OcrEngineExtension , yourDocument : Document ) {
7983 // @Tag("Run OCR from Document")
8084 val document: Document = yourDocument
8185
@@ -100,22 +104,22 @@ fun generatePdfWithOcrLayerSnippet(scanbotSDK: ScanbotSDK, document: Document) {
100104 val pdfGenerator = scanbotSDK.createPdfGenerator()
101105
102106 val pdfConfig = PdfConfiguration (
103- attributes = PdfAttributes (
104- author = " " ,
105- title = " " ,
106- subject = " " ,
107- keywords = " " ,
108- creator = " "
109- ),
110- pageSize = PageSize .A4 ,
111- pageDirection = PageDirection .AUTO ,
112- dpi = 200 ,
113- jpegQuality = 100 ,
114- pageFit = PageFit .NONE ,
115- resamplingMethod = ResamplingMethod .NONE ,
107+ attributes = PdfAttributes (
108+ author = " " ,
109+ title = " " ,
110+ subject = " " ,
111+ keywords = " " ,
112+ creator = " "
113+ ),
114+ pageSize = PageSize .A4 ,
115+ pageDirection = PageDirection .AUTO ,
116+ dpi = 200 ,
117+ jpegQuality = 100 ,
118+ pageFit = PageFit .NONE ,
119+ resamplingMethod = ResamplingMethod .NONE ,
116120 )
117- val ocrConfig = OcrEngine .OcrConfig (
118- engineMode = OcrEngine .EngineMode .SCANBOT_OCR
121+ val ocrConfig = OcrEngineExtension .OcrConfig (
122+ engineMode = OcrEngineExtension .EngineMode .SCANBOT_OCR
119123 )
120124 val pdfGenerated = pdfGenerator.generateWithOcrFromDocument(
121125 document = document,
@@ -151,8 +155,8 @@ fun generatePdfWithOcrLayerFormUrisSnippet(scanbotSDK: ScanbotSDK, imageFileUris
151155 pageFit = PageFit .NONE ,
152156 resamplingMethod = ResamplingMethod .NONE ,
153157 )
154- val ocrConfig = OcrEngine .OcrConfig (
155- engineMode = OcrEngine .EngineMode .SCANBOT_OCR
158+ val ocrConfig = OcrEngineExtension .OcrConfig (
159+ engineMode = OcrEngineExtension .EngineMode .SCANBOT_OCR
156160 )
157161 val generatedPdfFile = pdfGenerator.generateWithOcrFromUris(
158162 imageFileUris = imageFileUris,
0 commit comments