├── GoOCR v5.0 - Desktop ├── Code.gs ├── CreateReport.gs ├── Functions.gs ├── JS-ConnectToWeb.html ├── JS-GoOCR-Desktop.html ├── StyleCSS.html └── home.html ├── GoOCR v5.0 - Mobile ├── Code.gs ├── CreateReport.gs ├── Functions.gs ├── Initialization.gs ├── home.html ├── page-CSS.html └── page-JS.html ├── LICENSE └── README.md /GoOCR v5.0 - Desktop/Code.gs: -------------------------------------------------------------------------------- 1 | //Go OCR v5.0 2 | //******************************************* 3 | // Must Add Drive API(Services) for This App 4 | //******************************************* 5 | 6 | // enable V8 runtime 7 | 8 | 9 | 10 | function doGet() { 11 | return render('home'); 12 | } 13 | 14 | 15 | 16 | function include(filename){ 17 | return HtmlService.createHtmlOutputFromFile(filename).getContent(); 18 | } 19 | 20 | 21 | 22 | function render(file, argsObject) { 23 | var tmp = HtmlService.createTemplateFromFile(file); 24 | if(argsObject) { 25 | var keys = Object.keys(argsObject); 26 | keys.forEach(function(key){ 27 | tmp[key] = argsObject[key]; 28 | }); 29 | } 30 | return tmp.evaluate().setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL); 31 | } 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /GoOCR v5.0 - Desktop/CreateReport.gs: -------------------------------------------------------------------------------- 1 | 2 | 3 | function UpdateJSON(device, isSecretFile, fileSize) { 4 | var mc = 0; 5 | var dc = 0; 6 | var urlc = 0; 7 | var sc = 0; 8 | var sizeMB = parseFloat(fileSize.split('MB')[0]); 9 | var date = Utilities.formatDate(new Date(), "GMT+0530", "dd/MM/yyyy"); 10 | 11 | if(device == 'Mobile'){ mc = 1; } 12 | if(device == 'Desktop'){ dc = 1; } 13 | if(device == 'Desktop-URL'){ dc = 1; urlc = 1; } 14 | if(isSecretFile == 'SecretFile'){ sc = 1; } 15 | 16 | var record = { 17 | "date": date, 18 | "TotalConvert": 1, 19 | "MobileConvert": mc, 20 | "DesktopConvert": dc, 21 | "ConvertByLink": urlc, 22 | "SecretFile": sc, 23 | "FileSizeMB": sizeMB 24 | }; 25 | 26 | var addRec = JSON.stringify(record) + ','; 27 | updateTxtReport(addRec); 28 | } 29 | 30 | 31 | function updateTxtReport(newRec){ 32 | var file = DriveApp.getFileById('1IWrKXNOg9vUWHD3GTQjgMFg61EupG7uj'); 33 | var combinedContent = file.getBlob().getDataAsString() +"\r\n"+ newRec; 34 | file.setContent(combinedContent); 35 | } 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /GoOCR v5.0 - Desktop/Functions.gs: -------------------------------------------------------------------------------- 1 |  2 | // ************ Function for URL File *************************** 3 | 4 | function ocrByURL(e){ 5 | var Action, setFileas; 6 | 7 | try { 8 | var fileURL = e.imageFileUrl; 9 | var OCRlang = e.languagelistURL; 10 | var isSecretFile = e.isSecretFileURL; 11 | 12 | var file = UrlFetchApp.fetch(fileURL, {muteHttpExceptions: true}); 13 | var UploadStatus = "File Fetch Successfully!"; 14 | 15 | Logger.log( fileURL + " OCR Language: " + OCRlang); 16 | 17 | } catch (m) { 18 | UploadStatus = m.toString(); 19 | Logger.log( m.toString()); 20 | } 21 | 22 | 23 | 24 | if(UploadStatus == "File Fetch Successfully!"){ 25 | 26 | var blob = file.getBlob(); 27 | 28 | var resource = { 29 | title: blob.getName(), 30 | mimeType: blob.getContentType() 31 | }; 32 | 33 | 34 | // If OCR language Selected 35 | // Enable the Advanced Drive API Service 36 | if(OCRlang == "DefaultLang" || OCRlang == "MultiLang"){ 37 | var fileId = Drive.Files.insert(resource, blob, {ocr: true}).id; 38 | } else { 39 | var fileId = Drive.Files.insert(resource, blob, {ocr: true, ocrLanguage: OCRlang}).id; 40 | } 41 | 42 | 43 | try{ 44 | var doc = DocumentApp.openById(fileId); 45 | } catch (er) { 46 | return ["Error : " 47 | + er.toString() 48 | + "\r\n" + "\r\n" +"Try :- " 49 | +"\r\n" + "1. Sign-in your Google Account in Browser." 50 | +"\r\n" + "2. Do not use Guest mode, Incognito mode or Private mode." 51 | +"\r\n" + "3. If you are logged into multiple Google accounts, Sign-out all your Google accounts and back into just one.", fileId, 'Error', 'Error']; 52 | } 53 | 54 | 55 | var docName = doc.getName(); 56 | var text = doc.getBody().getText(); 57 | 58 | var OCRtext = text; 59 | 60 | if (!OCRtext.replace(/\s/g, '').length) { 61 | Action = "Sorry! Image OCR are unable to extract text from the file."; 62 | } else { 63 | Action = OCRtext; 64 | } 65 | 66 | 67 | if(isSecretFile == "on"){ 68 | Drive.Files.remove(fileId); 69 | setFileas = 'SecretFile'; 70 | }else{ 71 | DriveApp.getFileById(fileId).setTrashed(true); 72 | setFileas = 'Normal'; 73 | } 74 | 75 | 76 | }else{ 77 | Action = UploadStatus; 78 | } 79 | 80 | return [Action, fileId, docName, setFileas]; 81 | 82 | } 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | // ************ Function for Upload File *************************** 92 | 93 | 94 | 95 | function uploadFile(fileData) { 96 | 97 | var Action, FileId; 98 | 99 | var findFolder = getFolder('OCR Pro - Desktop'); 100 | if(findFolder == "null"){ 101 | var folder = DriveApp.createFolder('OCR Pro - Desktop'); 102 | }else{ 103 | folder = findFolder; 104 | } 105 | 106 | 107 | try { 108 | //var img = form.imageFile; 109 | var OCRlang = fileData.ocrLang; 110 | var isSecretFile = fileData.ocrSecret; 111 | 112 | var fileBlob = Utilities.newBlob(fileData.bytes, fileData.mimeType, fileData.filename); 113 | var OCRimage = DriveApp.createFile(fileBlob); 114 | //var OCRimage = folder.createFile(img); 115 | 116 | var UploadStatus = "File Uploaded Successfully!"; 117 | Action = 'success'; 118 | FileId = OCRimage.getId(); 119 | 120 | } catch (m) { 121 | UploadStatus = m.toString(); 122 | Logger.log( m.toString()); 123 | Action = 'error'; 124 | } 125 | 126 | return [Action, FileId, OCRlang, isSecretFile]; 127 | } 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | function getOCRtext(imgFileId,OCRlang,isSecretFile){ 136 | 137 | var Action, setFileas; 138 | var ImageID = imgFileId; 139 | 140 | var blob = DriveApp.getFileById(ImageID).getBlob(); 141 | var resource = { 142 | title: blob.getName(), 143 | mimeType: blob.getContentType() 144 | }; 145 | 146 | 147 | // If OCR language Selected 148 | // Enable the Advanced Drive API Service 149 | if(OCRlang == "DefaultLang" || OCRlang == "MultiLang"){ 150 | var fileId = Drive.Files.insert(resource, blob, {ocr: true}).id; 151 | //var fileId = Drive.Files.copy({mimeType: MimeType.GOOGLE_DOCS}, ImageID).id; 152 | } else { 153 | var fileId = Drive.Files.insert(resource, blob, {ocr: true, ocrLanguage: OCRlang}).id; 154 | } 155 | 156 | 157 | 158 | try{ 159 | var doc = DocumentApp.openById(fileId); 160 | } catch (er) { 161 | return ["Error : " 162 | + er.toString() 163 | + "\r\n" + "\r\n" +"Try :- " 164 | +"\r\n" + "1. Sign-in your Google Account in Browser." 165 | +"\r\n" + "2. Do not use Guest mode, Incognito mode or Private mode." 166 | +"\r\n" + "3. If you are logged into multiple Google accounts, Sign-out all your Google accounts and back into just one.", fileId, 'Error', 'Error']; 167 | } 168 | 169 | 170 | var docName = doc.getName(); 171 | var OCRtext = doc.getBody().getText(); 172 | 173 | if (!OCRtext.replace(/\s/g, '').length) { 174 | Action = "Sorry! Image OCR are unable to extract text from the file."; 175 | } else { 176 | Action = OCRtext; 177 | } 178 | 179 | 180 | 181 | if(isSecretFile == "on"){ 182 | // Permanently deleted Image file 183 | Drive.Files.remove(fileId); 184 | Drive.Files.remove(ImageID); 185 | setFileas = 'SecretFile'; 186 | }else{ 187 | // Move to Trashed Image file 188 | DriveApp.getFileById(fileId).setTrashed(true); 189 | DriveApp.getFileById(ImageID).setTrashed(true); 190 | setFileas = 'Normal'; 191 | } 192 | 193 | return [Action, fileId, docName, setFileas]; 194 | 195 | 196 | } 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | function CountFileConverted() { 207 | var ss = SpreadsheetApp.openById("1avo77F4KrxNM8qiX1_XQYCHwR6HdIt4wlvwcSEBRxM8"); 208 | var sheet = ss.getSheetByName("OCR Pro"); 209 | var data = sheet.getDataRange().getValues(); 210 | 211 | var TodayConvert = data[3][2]; 212 | var TotalConvert = data[6][2]; 213 | 214 | sheet.getRange("C4").setValue(TodayConvert+1); 215 | sheet.getRange("C7").setValue(TotalConvert+1); 216 | return TodayConvert + 1; 217 | } 218 | 219 | 220 | 221 | 222 | function getAppRate() { 223 | var ss = SpreadsheetApp.openById("1avo77F4KrxNM8qiX1_XQYCHwR6HdIt4wlvwcSEBRxM8"); 224 | var sheet = ss.getSheetByName("OCR Pro"); 225 | var data = sheet.getDataRange().getValues(); 226 | 227 | var AppRating = data[17][2]; 228 | 229 | return AppRating; 230 | } 231 | 232 | 233 | 234 | function updateRatingSheet(star){ 235 | var ss = SpreadsheetApp.openById("1avo77F4KrxNM8qiX1_XQYCHwR6HdIt4wlvwcSEBRxM8"); 236 | var sheet = ss.getSheetByName("OCR Pro"); 237 | var data = sheet.getDataRange().getValues(); 238 | 239 | var Star5 = data[11][2]; 240 | var Star4 = data[12][2]; 241 | var Star3 = data[13][2]; 242 | var Star2 = data[14][2]; 243 | var Star1 = data[15][2]; 244 | var Star0 = data[16][2]; 245 | 246 | if(star == 5){sheet.getRange("C12").setValue(Star5+1);} 247 | if(star == 4){sheet.getRange("C13").setValue(Star4+1);} 248 | if(star == 3){sheet.getRange("C14").setValue(Star3+1);} 249 | if(star == 2){sheet.getRange("C15").setValue(Star2+1);} 250 | if(star == 1){sheet.getRange("C16").setValue(Star1+1);} 251 | if(star == 0){sheet.getRange("C17").setValue(Star0+1);} 252 | 253 | } 254 | 255 | 256 | 257 | function SaveUserReview( star, review, convertFile, PageID){ 258 | 259 | updateRatingSheet(star); 260 | 261 | try { 262 | // do stuff, including send email 263 | var recipientsTO = "myocreader@gmail.com" + "," + "abonzer2@gmail.com"; 264 | 265 | MailApp.sendEmail({ 266 | to: recipientsTO, 267 | subject: "GoOCR (desktop) User Review", 268 | htmlBody: "Star Rating: "+star+"

Review: "+review+"

User-convert-File: "+convertFile +"

convert : "+PageID, 269 | }); 270 | 271 | var json = { 'action':'Success', 'msg':'Thanks for your feedback!' }; 272 | 273 | } catch(e) { 274 | Logger.log("Error with email (" + email + "). " + e); 275 | var json = { 'action':'Error', 'msg':e }; 276 | } 277 | 278 | return json; 279 | } 280 | 281 | 282 | 283 | 284 | // ___________________________________________________ 285 | 286 | 287 | // ---------------------------------------------------- 288 | // ############### Connect to Web ################# 289 | // ---------------------------------------------------- 290 | 291 | 292 | // ___________________________________________________ 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | // ************ Function for URL File *************************** 303 | 304 | function ConnectionCode(formObj) { 305 | var Action; 306 | 307 | var validCaptcha = verifyCaptcha(formObj); 308 | 309 | if(!validCaptcha){ 310 | return 'Invalid captcha please try again.'; 311 | } else { 312 | 313 | 314 | var Code = formObj.ConnectionCode; 315 | var ConnectionCode = Code.toUpperCase(); 316 | var fileTime = new Date().getTime(); 317 | var OTP = ""; 318 | 319 | var possible = "0123456789"; 320 | 321 | for (var i = 0; i < 5; i++) 322 | OTP += possible.charAt(Math.floor(Math.random() * possible.length)); 323 | 324 | var findFolder = getFolder('OCR Pro - Web Connect'); 325 | if (findFolder == "null") { 326 | var folder = DriveApp.createFolder('OCR Pro - Web Connect'); 327 | } else { 328 | folder = findFolder; 329 | } 330 | 331 | var myFileName = "OCR Web Connect - " + ConnectionCode; 332 | 333 | var FindFile = FindFiles(myFileName, folder); 334 | if (FindFile == "null") { 335 | var document = DocumentApp.create(myFileName); 336 | var paragraph = document.appendParagraph("#tags#-LogFile_-GetFileTime:" + fileTime + "#EndGetFileTime_-GetOTP:" + OTP + "#EndGetOTP_-GetConnectionStatus:null" + "__#end#split__"); 337 | 338 | document.saveAndClose(); 339 | 340 | var file = DriveApp.getFileById(document.getId()); 341 | // Get root directory 342 | var parents = file.getParents(); 343 | // Remove file from root folder 344 | parents.next().removeFile(file); 345 | // Add file to the specified folder 346 | folder.addFile(file); 347 | 348 | var digest = Utilities.computeDigest(Utilities.DigestAlgorithm.SHA_256, document.getId(), Utilities.Charset.US_ASCII); 349 | 350 | return digest; 351 | 352 | } else { 353 | return "Oops! Something went wrong. Please try again later."; 354 | } 355 | } 356 | } 357 | 358 | 359 | 360 | 361 | 362 | var secret_key = "6LcXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXwjMJ2lQeV"; 363 | 364 | 365 | function verifyCaptcha(response){ 366 | var url = 'https://www.google.com/recaptcha/api/siteverify'; 367 | var payload = { 368 | 'secret' : secret_key, 369 | 'response': response['g-recaptcha-response'] 370 | } 371 | var resp = UrlFetchApp.fetch(url, { 372 | payload : payload, 373 | method : 'POST' 374 | }).getContentText(); 375 | return JSON.parse(resp).success; 376 | } 377 | 378 | 379 | 380 | 381 | 382 | // ****************** Function Validate OTP ******************* 383 | 384 | function validateOTP(userOTP, ConnectionLog) { 385 | 386 | var fileID = FileIDfromHASH(ConnectionLog); 387 | 388 | if (fileID != "null") { 389 | 390 | var docText = DocumentApp.openById(fileID).getBody().getText(); 391 | var n = docText.indexOf("-GetConnectionStatus:null-Ready"); 392 | var OTP = docText.split(/-GetOTP:|#EndGetOTP_/)[1]; 393 | var FileTime = docText.split(/-GetFileTime:|#EndGetFileTime_/)[1]; 394 | var duration = new Date().getTime() - FileTime; // millisecounds 395 | 396 | if (OTP !== userOTP) { 397 | return ["Failed", "Invalid OTP entered."]; 398 | } 399 | 400 | if (duration > 300000 || n < 0) { 401 | return ["Failed", "OTP has expired. Please try again to connecting the device."]; 402 | } 403 | 404 | if (OTP == userOTP) { 405 | var tags = docText.split("__#end#split__")[0]; 406 | var OCRtext = docText.split("__#end#split__")[1]; 407 | var reset = tags.replace("-GetConnectionStatus:null-Ready", "-GetConnectionStatus:Active"); 408 | DocumentApp.openById(fileID).setText(reset + "__#end#split__"); 409 | 410 | return ["Success", OCRtext]; 411 | 412 | } 413 | 414 | return ["Failed", "Oops!"]; 415 | 416 | } else { 417 | return ["Failed", "Oops! Connection Interrupted. Please try to reconnecting the device."]; 418 | 419 | } 420 | 421 | } 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | // ****************** Function Reload ******************* 430 | 431 | function Reload(ConnectionLog) { 432 | 433 | var fileID = FileIDfromHASH(ConnectionLog); 434 | 435 | if (fileID != "null") { 436 | 437 | var docText = DocumentApp.openById(fileID).getBody().getText(); 438 | var tags = docText.split("__#end#split__")[0]; 439 | var OCRtext = docText.split("__#end#split__")[1]; 440 | 441 | return ["Success", OCRtext]; 442 | 443 | return ["Failed", "Oops! Device not connected."]; 444 | 445 | } else { 446 | return ["Failed", "Oops! Connection Interrupted."]; 447 | 448 | } 449 | return ["Failed", "Oops!"]; 450 | } 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | // ****************** Function ClearTxt ******************* 460 | 461 | function ClearText(ConnectionLog) { 462 | 463 | var fileID = FileIDfromHASH(ConnectionLog); 464 | 465 | if (fileID != "null") { 466 | 467 | var docText = DocumentApp.openById(fileID).getBody().getText(); 468 | var tags = docText.split("__#end#split__")[0]; 469 | DocumentApp.openById(fileID).getBody().setText(tags + "__#end#split__"); 470 | 471 | var OCRtext = docText.split("__#end#split__")[1]; 472 | 473 | if(OCRtext == "") {return ["Success", "All Text has Cleared."];} 474 | 475 | return ["Failed", "Oops! Device not connected."]; 476 | 477 | } else { 478 | return ["Failed", "Oops! Connection Interrupted."]; 479 | 480 | } 481 | return ["Failed", "Oops!"]; 482 | } 483 | 484 | 485 | 486 | 487 | 488 | 489 | // ****************** Function LogOut ******************* 490 | 491 | function LogOut(ConnectionLog) { 492 | var fileID = FileIDfromHASH(ConnectionLog); 493 | if (fileID != "null") { 494 | Drive.Files.remove(fileID); 495 | } 496 | } 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | function getFolder(folderName) { 505 | var parentFolder = DriveApp.getFolderById('18cm0NfzFo3jqoZgD5R9DNbRxYipv5oEV'); 506 | var folders = parentFolder.getFolders(); 507 | while (folders.hasNext()) { 508 | var folder = folders.next(); 509 | if (folderName == folder.getName()) { 510 | return folder; 511 | } 512 | } 513 | return "null"; 514 | } 515 | 516 | 517 | 518 | 519 | 520 | function FindFiles(fileName, folder) { 521 | 522 | var files = folder.getFiles(); 523 | while (files.hasNext()) { 524 | var file = files.next(); 525 | if (fileName == file.getName()) { 526 | 527 | var docText = DocumentApp.openById(file.getId()).getBody().getText(); 528 | var n = docText.indexOf("-GetConnectionStatus:null"); 529 | 530 | if (n > 0) { 531 | var rtrnFromDLET = Drive.Files.remove(file.getId()); 532 | } else { 533 | return file.getId(); 534 | } 535 | 536 | } 537 | } 538 | return "null"; 539 | } 540 | 541 | 542 | 543 | 544 | 545 | function FileIDfromHASH(ConnectionLog) { 546 | var myFolder = getFolder('OCR Pro - Web Connect'); 547 | var files = myFolder.getFiles(); 548 | 549 | while (files.hasNext()) { 550 | var file = files.next(); 551 | 552 | var FileID = file.getId(); 553 | var digest = Utilities.computeDigest(Utilities.DigestAlgorithm.SHA_256, FileID, Utilities.Charset.US_ASCII); 554 | 555 | var checkFile = compareArrays(ConnectionLog, digest); 556 | 557 | if (checkFile == true) { 558 | return FileID; 559 | } 560 | 561 | } 562 | return "null"; 563 | 564 | } 565 | 566 | 567 | 568 | 569 | 570 | 571 | function CleanFolder() { 572 | var myFolder = getFolder('OCR Pro - Web Connect'); 573 | var files = myFolder.getFiles(); 574 | 575 | while (files.hasNext()) { 576 | var file = files.next(); 577 | Drive.Files.remove(file.getId()); 578 | 579 | } 580 | } 581 | 582 | 583 | 584 | 585 | 586 | function compareArrays(ConnectionLog, digestHash) { 587 | 588 | var A = ConnectionLog; 589 | var B = digestHash; 590 | // compare lengths 591 | if (A.length != B.length) 592 | return false; 593 | 594 | for (var i = 0; i < A.length; i++) { 595 | 596 | if (A[i] != B[i]) { 597 | return false; 598 | } 599 | } 600 | return true; 601 | } 602 | 603 | 604 | -------------------------------------------------------------------------------- /GoOCR v5.0 - Desktop/JS-ConnectToWeb.html: -------------------------------------------------------------------------------- 1 | 316 | 317 | -------------------------------------------------------------------------------- /GoOCR v5.0 - Desktop/JS-GoOCR-Desktop.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /GoOCR v5.0 - Desktop/StyleCSS.html: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /GoOCR v5.0 - Mobile/Code.gs: -------------------------------------------------------------------------------- 1 | //Go OCR v5.0 2 | //******************************************* 3 | // Must Add Drive API(Services) for This App 4 | //******************************************* 5 | 6 | // enable V8 runtime 7 | 8 | function doGet() { 9 | return render('home'); 10 | } 11 | 12 | 13 | function include(filename){ 14 | return HtmlService.createHtmlOutputFromFile(filename).getContent(); 15 | } -------------------------------------------------------------------------------- /GoOCR v5.0 - Mobile/CreateReport.gs: -------------------------------------------------------------------------------- 1 | 2 | function UpdateJSON(device, isSecretFile, fileSize) { 3 | var mc = 0; 4 | var dc = 0; 5 | var urlc = 0; 6 | var sc = 0; 7 | var sizeMB = parseFloat(fileSize.split('MB')[0]); 8 | var date = Utilities.formatDate(new Date(), "GMT+0530", "dd/MM/yyyy"); 9 | 10 | if(device == 'Mobile'){ mc = 1; } 11 | if(device == 'Desktop'){ dc = 1; } 12 | if(device == 'Desktop-URL'){ dc = 1; urlc = 1; } 13 | if(isSecretFile == 'SecretFile'){ sc = 1; } 14 | 15 | var record = { 16 | "date": date, 17 | "TotalConvert": 1, 18 | "MobileConvert": mc, 19 | "DesktopConvert": dc, 20 | "ConvertByLink": urlc, 21 | "SecretFile": sc, 22 | "FileSizeMB": sizeMB 23 | }; 24 | 25 | var addRec = JSON.stringify(record) + ','; 26 | updateTxtReport(addRec); 27 | } 28 | 29 | 30 | function updateTxtReport(newRec){ 31 | var file = DriveApp.getFileById('1IWrKXNOg9vUWHD3GTQjgMFg61EupG7uj'); 32 | var combinedContent = file.getBlob().getDataAsString() +"\r\n"+ newRec; 33 | file.setContent(combinedContent); 34 | } 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /GoOCR v5.0 - Mobile/Functions.gs: -------------------------------------------------------------------------------- 1 | 2 | function uploadFile(fileData) { 3 | 4 | var Action, FileId; 5 | var findFolder = getFolder('OCR Pro - Mobile'); 6 | 7 | if(findFolder == "null"){ 8 | var folder = DriveApp.createFolder('OCR Pro - Mobile'); 9 | }else{ 10 | folder = findFolder; 11 | } 12 | 13 | 14 | try { 15 | //var img = form.imageFile; 16 | var OCRlang = fileData.ocrLang; 17 | var isSecretFile = fileData.ocrSecret; 18 | var fileBlob = Utilities.newBlob(fileData.bytes, fileData.mimeType, fileData.filename); 19 | var OCRimage = DriveApp.createFile(fileBlob); 20 | 21 | //var OCRimage = folder.createFile(img); 22 | var UploadStatus = "File Uploaded Successfully!"; 23 | Action = 'success'; 24 | FileId = OCRimage.getId(); 25 | 26 | } catch (m) { 27 | UploadStatus = m.toString(); 28 | Logger.log( m.toString()); 29 | Action = 'error'; 30 | } 31 | 32 | return [Action, FileId, OCRlang, isSecretFile]; 33 | } 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | function getOCRtext(imgFileId,OCRlang, isSecretFile){ 42 | 43 | var Action, setFileas; 44 | var ImageID = imgFileId; 45 | var OCRimage = DriveApp.getFileById(ImageID); 46 | 47 | 48 | var blob = OCRimage.getBlob(); 49 | var resource = { 50 | title: blob.getName(), 51 | mimeType: blob.getContentType() 52 | }; 53 | 54 | 55 | // If OCR language Selected 56 | if(OCRlang == "DefaultLang" || OCRlang == "MultiLang"){ 57 | // Enable the Advanced Drive API Service 58 | var fileID = Drive.Files.insert(resource, blob, {ocr: true}).id; 59 | } else { 60 | var fileID = Drive.Files.insert(resource, blob, {ocr: true, ocrLanguage: OCRlang}).id; 61 | } 62 | 63 | 64 | try{ 65 | var doc = DocumentApp.openById(fileID); 66 | } catch (er) { 67 | return ["Error : " 68 | + er.toString() 69 | + "\r\n" + "\r\n" +"Try :- " 70 | +"\r\n" + "1. Sign-in your Google Account in Browser." 71 | +"\r\n" + "2. Do not use Guest mode, Incognito mode or Private mode." 72 | +"\r\n" + "3. If you are logged into multiple Google accounts, Sign-out all your Google accounts and back into just one.", fileID, 'Error', 'Error']; 73 | } 74 | 75 | 76 | var docName = doc.getName(); 77 | var text = doc.getBody().getText(); 78 | 79 | var OCRtext = text; 80 | 81 | if (!OCRtext.replace(/\s/g, '').length) { 82 | Action = "Sorry! Image OCR are unable to extract text from the file."; 83 | } else { 84 | Action = OCRtext; 85 | } 86 | 87 | 88 | 89 | var docID = doc.getId(); 90 | 91 | if(isSecretFile == "on"){ 92 | // permanently deleted Image file 93 | Drive.Files.remove(docID); 94 | Drive.Files.remove(ImageID); 95 | setFileas = 'SecretFile'; 96 | }else{ 97 | // Move to Trashed Image file 98 | DriveApp.getFileById(docID).setTrashed(true); 99 | DriveApp.getFileById(ImageID).setTrashed(true); 100 | setFileas = 'Normal'; 101 | } 102 | 103 | return [Action, fileID, docName, setFileas]; 104 | 105 | } 106 | 107 | 108 | 109 | 110 | 111 | 112 | function updateTextOnWeb(magicConnection, OCRtext){ 113 | 114 | try { 115 | var FileID = FileIDfromHASH(magicConnection); 116 | DocumentApp.openById(FileID).appendParagraph(OCRtext); 117 | return("Success"); 118 | } 119 | catch(e){ 120 | Logger.log(e); 121 | return e; 122 | } 123 | 124 | 125 | } 126 | 127 | 128 | 129 | 130 | 131 | function FatchOTP(myConnectionID, OCRtext){ 132 | 133 | var findFolder = getFolder('OCR Pro - Web Connect'); 134 | 135 | 136 | if(findFolder != "null"){ var folder = findFolder; } 137 | else{ 138 | var respR = { 139 | 'type': "Failed", 140 | 'msg':"Oops! Something went wrong. Please try again later.", 141 | 'log': "Folder Not Found" 142 | }; 143 | return respR; 144 | } 145 | 146 | 147 | var myFileName = "OCR Web Connect - " + myConnectionID; 148 | var FindFile = FindFiles(myFileName, folder); 149 | 150 | if(FindFile == "null"){ 151 | var respR = { 152 | 'type': "Failed", 153 | 'msg':"Oops! Something went wrong. Please try again later.", 154 | 'log': "File Not Found" 155 | }; 156 | return respR; 157 | } 158 | 159 | var docText = DocumentApp.openById(FindFile).getBody().getText(); 160 | var OTP = docText.split(/-GetOTP:|#EndGetOTP_/)[1]; 161 | var FileTime = docText.split(/-GetFileTime:|#EndGetFileTime_/)[1]; 162 | var duration = new Date().getTime() - FileTime ; 163 | 164 | if(duration > 300000 ){ 165 | var respR = { 166 | 'type': "Failed", 167 | 'msg': "OTP has expired. Please try again to connecting the device.", 168 | 'log': "File OTP Expire" 169 | }; 170 | return respR; 171 | } 172 | 173 | var tags = docText.split("__#end#split__")[0]; 174 | var reset = tags.replace("-GetConnectionStatus:null", "-GetConnectionStatus:null-Ready"); 175 | DocumentApp.openById(FindFile).setText(reset + "__#end#split__"); 176 | DocumentApp.openById(FindFile).appendParagraph(OCRtext); 177 | DriveApp.getFileById(FindFile).setName(FileTime + " - " + myConnectionID); 178 | 179 | var digest = getSHA256Enc(FindFile); 180 | var respR = { 181 | 'type': "Success", 182 | 'msg': OTP, 183 | 'log': digest 184 | }; 185 | return respR; 186 | 187 | var respR = { 188 | 'type': "Failed", 189 | 'msg': "Oops! Something went wrong. Please try again later.", 190 | 'log': "Other" 191 | }; 192 | return respR; 193 | 194 | 195 | } 196 | 197 | 198 | 199 | 200 | 201 | 202 | function FindFiles(fileName, folder){ 203 | Logger.log(fileName); 204 | var files = folder.getFiles(); 205 | while (files.hasNext()) { 206 | var file = files.next(); 207 | var fatchFileName = file.getName(); Logger.log(fatchFileName); 208 | if(fileName == fatchFileName) { 209 | return file.getId(); 210 | } 211 | } 212 | return "null"; 213 | } 214 | 215 | 216 | 217 | function CountFileConverted() { 218 | var ss = SpreadsheetApp.openById("1avo77F4KrxNM8qiX1_XQYCHwR6HdIt4wlvwcSEBRxM8"); 219 | var sheet = ss.getSheetByName("OCR Pro"); 220 | var data = sheet.getDataRange().getValues(); 221 | 222 | var TodayConvert = data[3][2]; 223 | var TotalConvert = data[6][2]; 224 | 225 | sheet.getRange("C4").setValue(TodayConvert+1); 226 | sheet.getRange("C7").setValue(TotalConvert+1); 227 | return TodayConvert+1; 228 | } 229 | 230 | 231 | 232 | 233 | function getAppRate() { 234 | var ss = SpreadsheetApp.openById("1avo77F4KrxNM8qiX1_XQYCHwR6HdIt4wlvwcSEBRxM8"); 235 | var sheet = ss.getSheetByName("OCR Pro"); 236 | var data = sheet.getDataRange().getValues(); 237 | 238 | var AppRating = data[17][2]; 239 | 240 | return AppRating; 241 | } 242 | 243 | 244 | 245 | 246 | 247 | function getFolder(folderName) { 248 | var parentFolder = DriveApp.getFolderById('18cm0NfzFo3jqoZgD5R9DNbRxYipv5oEV'); 249 | var folders = parentFolder.getFolders(); 250 | while (folders.hasNext()) { 251 | var folder = folders.next(); 252 | if (folderName == folder.getName()) { 253 | return folder; 254 | } 255 | } 256 | return "null"; 257 | } 258 | 259 | 260 | 261 | function updateRatingSheet(star){ 262 | var ss = SpreadsheetApp.openById("1avo77F4KrxNM8qiX1_XQYCHwR6HdIt4wlvwcSEBRxM8"); 263 | var sheet = ss.getSheetByName("OCR Pro"); 264 | var data = sheet.getDataRange().getValues(); 265 | 266 | var Star5 = data[11][2]; 267 | var Star4 = data[12][2]; 268 | var Star3 = data[13][2]; 269 | var Star2 = data[14][2]; 270 | var Star1 = data[15][2]; 271 | var Star0 = data[16][2]; 272 | 273 | if(star == 5){sheet.getRange("C12").setValue(Star5+1);} 274 | if(star == 4){sheet.getRange("C13").setValue(Star4+1);} 275 | if(star == 3){sheet.getRange("C14").setValue(Star3+1);} 276 | if(star == 2){sheet.getRange("C15").setValue(Star2+1);} 277 | if(star == 1){sheet.getRange("C16").setValue(Star1+1);} 278 | if(star == 0){sheet.getRange("C17").setValue(Star0+1);} 279 | 280 | } 281 | 282 | 283 | 284 | function SaveUserReview( star, review, convertFile, isWebConnect){ 285 | 286 | updateRatingSheet(star); 287 | 288 | try { 289 | // do stuff, including send email 290 | var recipientsTO = "myocreader@gmail.com" + "," + "abonzer2@gmail.com"; 291 | 292 | MailApp.sendEmail({ 293 | to: recipientsTO, 294 | subject: "GoOCR (mobile) User Review", 295 | htmlBody: "Star Rating: "+star+"

Review: "+review+"

User-convert-File: "+convertFile+"

Connect to Web : "+isWebConnect, 296 | }); 297 | 298 | var json = { 'action':'Success', 'msg':'Thanks for your feedback!' }; 299 | 300 | } catch(e) { 301 | Logger.log("Error with email (" + email + "). " + e); 302 | var json = { 'action':'Error', 'msg':e }; 303 | } 304 | 305 | return json; 306 | } 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | function chkConnectionStatus(ConnectionLog) { 316 | 317 | try{ 318 | var fileID = FileIDfromHASH(ConnectionLog); 319 | if (fileID != "null") { 320 | var docText = DocumentApp.openById(fileID).getBody().getText(); 321 | var tags = docText.split("__#end#split__")[0]; 322 | var n = docText.indexOf('-GetConnectionStatus:Active'); 323 | 324 | if(n > -1){ 325 | return ["Success", "Device connected"]; 326 | }else{ 327 | return ["Failed", "Oops! Device not connected."]; 328 | } 329 | 330 | } else { 331 | return ["Failed", "Oops! Connection Interrupted."]; 332 | } 333 | return ["Failed", "Oops!"]; 334 | 335 | }catch(er){ 336 | return ["error", er]; 337 | } 338 | 339 | } 340 | 341 | 342 | 343 | 344 | function LogOut(ConnectionLog) { 345 | var fileID = FileIDfromHASH(ConnectionLog); 346 | if (fileID != "null") { 347 | Drive.Files.remove(fileID); 348 | } 349 | 350 | } 351 | 352 | 353 | function FileIDfromHASH(ConnectionLog) { 354 | var myFolder = getFolder('OCR Pro - Web Connect'); 355 | var files = myFolder.getFiles(); 356 | 357 | while (files.hasNext()) { 358 | var file = files.next(); 359 | var FileID = file.getId(); 360 | var digest = getSHA256Enc(FileID); 361 | 362 | if (ConnectionLog == digest) { 363 | return FileID; 364 | } 365 | 366 | } 367 | return "null"; 368 | 369 | } 370 | 371 | 372 | 373 | 374 | 375 | function getSHA256Enc(value){ 376 | var signature = Utilities.computeDigest(Utilities.DigestAlgorithm.SHA_256, value); 377 | 378 | /** @type String */ 379 | var hexString = signature 380 | .map(function(byte) { 381 | // Convert from 2's compliment 382 | var v = (byte < 0) ? 256 + byte : byte; 383 | 384 | // Convert byte to hexadecimal 385 | return ("0" + v.toString(16)).slice(-2); 386 | }) 387 | .join(""); 388 | 389 | return hexString; 390 | } 391 | 392 | 393 | -------------------------------------------------------------------------------- /GoOCR v5.0 - Mobile/Initialization.gs: -------------------------------------------------------------------------------- 1 | function render(file, argsObject) { 2 | var tmp = HtmlService.createTemplateFromFile(file); 3 | if (argsObject) { 4 | var keys = Object.keys(argsObject); 5 | 6 | keys.forEach(function (key) { 7 | tmp[key] = argsObject[key]; 8 | }); 9 | } 10 | 11 | return tmp.evaluate().setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL); 12 | } -------------------------------------------------------------------------------- /GoOCR v5.0 - Mobile/home.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 |
23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 | 32 |
33 | keyboard_arrow_left 34 |
35 | 36 | 87 |
88 | 89 | 90 | 91 | 92 | 93 |
94 | 95 | 96 |
97 | Sign in 98 | About 99 | Connect to PC 100 | Desktop Site 101 | More Tools 102 |
103 | 104 | 105 | 106 |
107 | 108 | 115 | 116 | 117 | 120 | 121 | 129 | 130 |
131 | more_vert 132 |
133 | 134 |
135 | 136 | 137 |
138 | 139 | 140 |
141 | 142 |
143 | 144 |
145 | 146 |
147 |

Upload a scanned Image or PDF file

148 |

Upload .jpeg, .png, .gif or .pdf files, The file size should be 10 MB or less.

149 |
150 |
151 | 152 | 156 | 157 | 158 |
159 | 160 |
161 | 162 | 163 | 164 | 165 | 259 |
260 | 261 |
Advanced Options
262 | 263 | 264 |
265 | 266 |
267 | 268 |
269 | 270 | 271 | 272 | 273 | 317 | 318 | 319 | 320 | 321 | 322 | 362 | 363 | 364 | 365 | 366 | 367 | 410 | 411 | 412 | 413 | 414 | 415 | 417 | 418 |
419 |
420 | 421 |
422 | 423 |
424 |
N/A
425 | 426 |
N/A
427 | 428 |
429 |
430 | 431 | 432 | 433 | 437 | 438 |
439 |
440 | none 441 | clear 442 |
443 |
444 | 445 | 446 | 447 | 448 | -------------------------------------------------------------------------------- /GoOCR v5.0 - Mobile/page-CSS.html: -------------------------------------------------------------------------------- 1 |  729 | 730 | 731 | 732 | -------------------------------------------------------------------------------- /GoOCR v5.0 - Mobile/page-JS.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 744 | 745 | 746 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## [Live Demo](https://goocr.blogspot.com) 2 | 3 | # OCR-Pro 4 | OCR pro is a Free web application written in Google Apps Script, to Convert PDF and photo files to text. OCR pro use Google Drive's OCR technology Website: http://ocrpro.blogspot.in/ 5 | 6 | # GoOCR 7 | Now we have rebranded our app with goocr, our app ranked at the top of google’s search results with "goocr" keyword (25th feb 2021). new website: https://goocr.blogspot.com/ 8 | 9 | 10 | ## About 11 | 12 | ![GoOCR](https://1.bp.blogspot.com/-QaW68YgODDg/YDazv0HHRaI/AAAAAAAACyY/kypfFtGeUpMN-TvPJGn_2VQRit4AhOCUwCLcBGAsYHQ/s1578/gocr.PNG "GoOCR v5.0 - Desktop App with upgraded UI") 13 | 14 | Optical Character Recognition (OCR), a tool that lets you easily copy text from picture, scanned documents, printed books, etc. We can convert hardcopy document into editable digital document and avoid the retyping of a document. 15 | 16 | You can simply capture a picture of the printed text with your mobile phone, use AdobeScane App for impressive results and then upload a scanned image file. Once the OCR process is done, you will be able to copy-paste or edit the text content of that image. 17 | 18 | 19 | 20 | ## How does it work? 21 | 22 | The script use Google's OCR Technology, as you know you can [convert image files to text with Google Drive](https://support.google.com/drive/answer/176692), uploade file to Google Drive and then Open file with Google Docs. It does use same concept and automate the whole process. 23 | 24 | Collect image or PDF file from the user, Upload file to my Google Drive and then Create .doc file using Input-Image-File with enabling OCR option. Once the DOC file creates, the script will copy all text inside doc file and provide it as an output. At last, it will delete both image and DOC file, all tasks will be done by Google App Script. 25 | 26 | It also performs some other tasks like calculate processing time, count no of file converted, Sets a specific OCR language, which helps you to get the best results. 27 | 28 | 29 | 30 | ## Usage 31 | 32 | The OCR pro is free OCR tool and uses Google OCR Technology to perform OCR process, So get highly impressive text recognition accuracy. 33 | 34 | 35 | 36 | ### Use Google OCR on your Mobile Phone ### 37 | Currently [Google Drive OCR feature](https://support.google.com/drive/answer/176692) is only available for desktop computers and not on mobile devices and tablets. OCR Pro a free online tool that lets you use Google OCR feature on your android, iphone and ipad device. 38 | 39 | Let's Try: [GoOCR Pro For Mobile](https://goocr.blogspot.com/?p=App&app=mobile&utm_source=OCRpro(github)-File&utm_medium=OcrproWeb&utm_campaign=redNewApp) 40 | 41 | 42 | ### Connect to web ### 43 | ![GoOCR - Connect to web](https://1.bp.blogspot.com/-2q8cjH9eCmc/YDazwGNDwVI/AAAAAAAACyc/tVchCN0SorwN3SfYWIgAf-ZsONXdS2tHgCLcBGAsYHQ/s1576/goocrwc.PNG " GoOCR - Desktop App with Connect to web") 44 | Connect your mobile to take photos or upload files, and get editable text on your PC. 45 | 46 | A large number of OCR apps are available for desktop and mobile. But I could not find any app that provides "connect to web" feature. "Connect to the web" is a feature that allows you to connect your phone to a computer so that you can input from mobile and get output on your computer screen. With GoOCR you can use your phone as a portable OCR scanner for computer. 47 | 48 | 49 | ### Possible to Select the Specific Language ### 50 | Google will automatically detect the language of the document. For example, if you upload an image to OCR, Google automatically finds the language of the content of that image. If the image contains text in multiple languages, Google detects all the languages and extract text automatically. 51 | 52 | Sometimes Google is not able to detect the correct language nor allow you to select the language for OCR. The **OCR Pro makes it possible to choose a specific language** if Google is not detecting the accurate language. 53 | 54 | *Use this [Sample image](https://1.bp.blogspot.com/-1vyiTjYCOBA/Wk333v6D-JI/AAAAAAAAD6I/p8sIBv_zCSsSOyq9uIn5HyYxpCXHXpViACLcBGAs/s1600/CbSEJEWDEKyEyQ374etTVU5g.jpg) to test the difference before or after choose the language.* 55 | 56 | 57 | # 58 | 59 | ## *Pro Tips* 60 | 61 | There are a few Tips to produce optimal results from OCR 62 | 63 | - **Use CamScanner or other similar apps** to Scan Documents and should **save file as image** only (Not in PDF) 64 | 65 | - If you want to convert Scanned PDF, Firstly **convert PDF into multiple Image**. Because Images provide the most efficient and impressive results. 66 | 67 | - **Click Advanced Options and choose language**, don't select "Multi-Language" or "Auto Detection" unless you do not need for it. 68 | 69 | - Rotate Image for Proper Orientation - horizontal and reads from left to right. 70 | 71 | - Image quality will be Sharp and clear with white page 72 | 73 | - Make sure your file is in JPEG, PNG, GIF or PDF format and file is **2 MB or less** 74 | 75 | ### 76 | # 77 | 78 | ### [GoOCR Pro - Desktop](https://goocr.blogspot.com/?p=App&app=desktop&utm_source=OCRpro(github)-File&utm_medium=OcrproWeb&utm_campaign=redNewApp) 79 | ### [GoOCR Pro - Mobile](https://goocr.blogspot.com/?p=App&app=mobile&utm_source=OCRpro(github)-File&utm_medium=OcrproWeb&utm_campaign=redNewApp) 80 | --------------------------------------------------------------------------------