{"id":207959,"date":"2024-02-25T01:17:57","date_gmt":"2024-02-25T01:17:57","guid":{"rendered":"https:\/\/michigandigitalnews.com\/index.php\/2024\/02\/25\/easily-add-document-scanning-capability-to-your-app-with-ml-kit-document-scanner-api\/"},"modified":"2025-06-25T17:21:37","modified_gmt":"2025-06-25T17:21:37","slug":"easily-add-document-scanning-capability-to-your-app-with-ml-kit-document-scanner-api","status":"publish","type":"post","link":"https:\/\/michigandigitalnews.com\/index.php\/2024\/02\/25\/easily-add-document-scanning-capability-to-your-app-with-ml-kit-document-scanner-api\/","title":{"rendered":"Easily add document scanning capability to your app with ML Kit Document Scanner API"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div>\n<meta content=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEh9szIo2TBAryM51OQHMHjvoJRkwMs2Pa3NXmFxmZrWGdLC2c83LgSXwlf2MypoXN2IBz_3SOS-HQQqKDRAWYfWDmHeNyGl5KUaFkkJeEpKLA2NIX8Vtvrt7pnUdfDDTg6ZmOLfmhQKIldp9v96yadQnUa2r8fZUS6N2t9zPCPJNZteai33hPjUKq6z23k\/s1600\/a_new_foundtion_editorial-social.png\" name=\"twitter:image\"\/><br \/>\n<img decoding=\"async\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEh9szIo2TBAryM51OQHMHjvoJRkwMs2Pa3NXmFxmZrWGdLC2c83LgSXwlf2MypoXN2IBz_3SOS-HQQqKDRAWYfWDmHeNyGl5KUaFkkJeEpKLA2NIX8Vtvrt7pnUdfDDTg6ZmOLfmhQKIldp9v96yadQnUa2r8fZUS6N2t9zPCPJNZteai33hPjUKq6z23k\/s1600\/a_new_foundtion_editorial-social.png\" style=\"display: none;\"\/><\/p>\n<p><em>Posted by Thomas Ezan \u2013 Sr. Developer Relations Engineer; Chengji Yan, Penny Li \u2013 ML Kit Engineers; David Miro Llopis \u2013 Product Manager<\/em><\/p>\n<p><a href=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEjm1t-9xVtRVMAjnjo5Ji5Mpx9qcqcJgdeeEOpfOB4AtYrktrF6MhoMMC8VlPKhNxF0mT-D3GA8Ja8ig0KiYnV6bZRInjHxJbkbM1sOinK5SqmJGqeWWHUxYkJ-oB8iorE9-X4MVJUaYMTEn-FycA27R4eFcA2HaUKABbP5zJbWSnCNWPVQzJZkQAqBqeI\/s1600\/a_new_foundtion_editorial_header.png\"><img decoding=\"async\" border=\"0\" data-original-height=\"800\" data-original-width=\"1058\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEjm1t-9xVtRVMAjnjo5Ji5Mpx9qcqcJgdeeEOpfOB4AtYrktrF6MhoMMC8VlPKhNxF0mT-D3GA8Ja8ig0KiYnV6bZRInjHxJbkbM1sOinK5SqmJGqeWWHUxYkJ-oB8iorE9-X4MVJUaYMTEn-FycA27R4eFcA2HaUKABbP5zJbWSnCNWPVQzJZkQAqBqeI\/s1600\/a_new_foundtion_editorial_header.png\"\/><\/a><\/p>\n<p>We are excited to announce the launch of the <a href=\"https:\/\/developers.google.com\/ml-kit\/vision\/doc-scanner\" target=\"_blank\" rel=\"noopener\">ML Kit Document Scanner API<\/a>. This new API makes it easy to add advanced document scanning capabilities with a high-quality and consistent user interface to your Android app. The ML Kit Document Scanner API enables your users to quickly and easily digitize paper documents.<\/p>\n<p>Like the other ML Kit APIs, the ML Kit Document Scanner API enables you to seamlessly integrate features powered by Machine Learning (ML) without any ML knowledge.<\/p>\n<p><image><\/p>\n<div style=\"text-align: center;\"><img decoding=\"async\" alt=\"ml kit document scanner illustration\" border=\"0\" id=\"imgCaption\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEi3HKj8jUfxGqQIjF_4IdTi5FHiFqJ0Lh-SZmVLV62K08SunYqiT13hozvG4x6Rkf2gF8IhMdp7a6ZzGUT_iObDSJzVXkuIbAD_PD9Yb2uBCnqWPQE6VNEj7wpqHkzCeVW7jN4fNi0spo3Tx0EV2V-rxlC_5GrlegWEzIeGEDq024Dir8LPCia8s4vctnE\/s1600\/image4.png\" width=\"100%\"\/><\/div>\n<p><\/image><\/p>\n<h3>Why Document Scanner SDK?<\/h3>\n<p>Despite the digital revolution, paper documents and printouts are still present in our everyday life. Some of our most important documents are still physical (identity documents, receipts, etc.).<\/p>\n<p>The ML Kit Document Scanner API offers a number of benefits, including:<\/p>\n<ul>\n<ul>\n<li>A high-quality and consistent user interface for digitizing physical documents.<\/li>\n<li>Accurate document detection with precise corner and edge detection for a seamless scanning experience and optimal scanning results.<\/li>\n<li>Flexible functionality allows users to crop scanned documents, apply filters, remove fingers, remove stains and other blemishes and send digitized files in PDF and JPEG formats back to your app.<\/li>\n<li>On-device processing helps preserve privacy.<\/li>\n<li>A complete solution eliminating the need for camera permission.<\/li>\n<\/ul>\n<\/ul>\n<p>The ML Kit Document Scanner API is already used by Google Drive Android application and the Google Pixel Camera.<\/p>\n<p><image><\/p>\n<div style=\"text-align: center;\"><img decoding=\"async\" alt=\"moving image showing ML Kit Document scanner API in action in  &#10;Google Drive\" border=\"0\" id=\"imgCaption\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEhtQtiEsIs_LrwPwkt6LoySSeA9sEjbBraOfzsFlLEBi1OdCyeR7JJjH42KtkiaawCdBpAXEG_BgokdO4kE2iptk9TCgpC5ld8FURaEjqpu32tlROVDZbjRtgK3biAsSnrobbvAGJSJ2bJYH8h9uj6Y-zx1aJPRI8-fIaKv5Cgaco3Q5JBdZAGbcIL6ztY\/s1600\/docscan_demo.gif\" width=\"50%\"\/><\/div>\n<p><imgcaption><center><em>ML Kit Document scanner API in action in<br \/>\nGoogle Drive<\/em><\/center><\/imgcaption><\/image><\/p>\n<h3>Get started<\/h3>\n<p>The ML Kit Document Scanner API requires Android API level 21 or above. The models, scanning logic, and UI flow are dynamically downloaded via Google Play services so the ML Kit Document Scanner API has a minimal impact on your app size.<\/p>\n<p>To integrate it in your app, start by configuring the scanner options and getting a scanner client:<\/p>\n<div style=\"background: rgb(248, 248, 248); border: 0px; overflow: auto; width: auto;\">\n<pre style=\"line-height: 125%; margin: 0px;\"><span style=\"font-family: courier;\">val options <span style=\"color: #666666;\">=<\/span> GmsDocumentScannerOptions<span style=\"color: #666666;\">.<\/span>Builder()\n    <span style=\"color: #666666;\">.<\/span>setGalleryImportAllowed(false)\n    <span style=\"color: #666666;\">.<\/span>setPageLimit(<span style=\"color: #666666;\">2<\/span>)\n    <span style=\"color: #666666;\">.<\/span>setResultFormats(RESULT_FORMAT_JPEG, RESULT_FORMAT_PDF)\n    <span style=\"color: #666666;\">.<\/span>setScannerMode(SCANNER_MODE_FULL)\n    <span style=\"color: #666666;\">.<\/span>build()\nval scanner <span style=\"color: #666666;\">=<\/span> GmsDocumentScanning<span style=\"color: #666666;\">.<\/span>getClient(options)<\/span>\n<\/pre>\n<\/div>\n<p>Then register an <span style=\"color: #0d904f; font-family: Courier;\">ActivityResultCallback<\/span> to receive the scanning results:<\/p>\n<div style=\"background: rgb(248, 248, 248); border: 0px; overflow: auto; width: auto;\">\n<pre style=\"line-height: 125%; margin: 0px;\"><span style=\"font-family: courier;\">val scannerLauncher <span>=<\/span> registerForActivityResult(StartIntentSenderForResult()) {\n  result <span>-&gt;<\/span> {\n    <span>if<\/span> (result<span>.<\/span>resultCode <span>==<\/span> RESULT_OK) {\n      val result <span>=<\/span>\n        GmsDocumentScanningResult<span>.<\/span>fromActivityResultIntent(result<span>.<\/span>data)\n      result<span>.<\/span>getPages()<span>?.<\/span>let { pages <span>-&gt;<\/span>\n        <span>for<\/span> (page in pages) {\n          val imageUri <span>=<\/span> page<span>.<\/span>getImageUri()\n        }\n      }\n      result<span>.<\/span>getPdf()<span>?.<\/span>let { pdf <span>-&gt;<\/span>\n        val pdfUri <span>=<\/span> pdf<span>.<\/span>getUri()\n        val pageCount <span>=<\/span> pdf<span>.<\/span>getPageCount()\n      }\n    }\n  }\n}<\/span>\n<\/pre>\n<\/div>\n<p>Finally launch the document scanner activity:<\/p>\n<div style=\"background: rgb(248, 248, 248); border: 0px; overflow: auto; width: auto;\">\n<pre style=\"line-height: 125%; margin: 0px;\"><span style=\"font-family: courier;\">scanner<span>.<\/span>getStartScanIntent(activity)\n  <span>.<\/span>addOnSuccessListener { intentSender <span>-&gt;<\/span>   \n    scannescannerrLauncher<span>.<\/span>launch(IntentSenderRequest<span>.<\/span>Builder(intentSender)<span>.<\/span>build())\n  }\n  <span>.<\/span>addOnFailureListener { <span>...<\/span> }\n<\/span><\/pre>\n<\/div>\n<p>To get started with the ML Kit Document Scanner API, visit the <a href=\"https:\/\/developers.google.com\/ml-kit\/vision\/doc-scanner\" target=\"_blank\" rel=\"noopener\">documentation<\/a>. We can\u2019t wait to see what you\u2019ll build with it!<\/p>\n<\/div>\n<p>[ad_2]<br \/>\n<br \/><a href=\"http:\/\/android-developers.googleblog.com\/2024\/02\/ml-kit-document-scanner-api.html\">Source link <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] Posted by Thomas Ezan \u2013 Sr. Developer Relations Engineer; Chengji Yan, Penny Li \u2013 ML Kit Engineers; David Miro Llopis \u2013 Product Manager We<\/p>\n","protected":false},"author":1,"featured_media":207960,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[146],"tags":[],"_links":{"self":[{"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/posts\/207959"}],"collection":[{"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/comments?post=207959"}],"version-history":[{"count":3,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/posts\/207959\/revisions"}],"predecessor-version":[{"id":342377,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/posts\/207959\/revisions\/342377"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/media\/207960"}],"wp:attachment":[{"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/media?parent=207959"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/categories?post=207959"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/tags?post=207959"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}