diff --git a/locallib.php b/locallib.php
index bdf20c957fd453cfce2d92faf58f2d464f381eac..d3acd7109464593fc5151fcac80034b4f5fd68e4 100644
--- a/locallib.php
+++ b/locallib.php
@@ -58,7 +58,7 @@ function pdfannotator_display_embed($pdfannotator, $cm, $course, $file, $page =
     $PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/pdf.js"));
     $PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/pdf_viewer.js"));
     $PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/textclipper.js"));
-    $PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/index.js?ver=00012"));
+    $PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/index.js?ver=00012i"));
     $PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/locallib.js?ver=00002"));
 
     // Pass parameters from PHP to JavaScript.
diff --git a/shared/index.js b/shared/index.js
index 441e91b584385d7cc16ac8ea3792839e26e09c7a..8512f9c88bc5cef532e21f2888424371303574e6 100644
--- a/shared/index.js
+++ b/shared/index.js
@@ -5503,7 +5503,46 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
                 if(lines.length<=1){return;}
                 if(path){svg.removeChild(path);}
                 path=(0,_appendChild2.default)(svg,{type:'drawing',color:_penColor,width:_penSize,lines:lines});
-            }/**
+            }
+            function handeContentTouchstart(e) {
+                document.documentElement.style.overflow = 'hidden';
+                document.getElementById('content-wrapper').style.overflow = 'hidden';
+                path=null;
+                lines=[];
+                savePoint(e.pageX,e.pageY);
+            }
+            function handeContentTouchmove(e) {
+                savePoint(e.pageX,e.pageY);
+            }
+            function handeContentTouchend(e) {
+                document.documentElement.style.overflow = 'auto';
+                document.getElementById('content-wrapper').style.overflow = 'auto';
+                var svg=void 0;
+                if (lines.length > 1 && (svg = (0,_utils.findSVGAtPoint)(e.pageX,e.pageY))){
+                    var _getMetadata=(0,_utils.getMetadata)(svg);
+                    var documentId=_getMetadata.documentId;
+                    var pageNumber=_getMetadata.pageNumber;
+                    _PDFJSAnnotate2.default.getStoreAdapter().addAnnotation(documentId,pageNumber,{type:'drawing',width:_penSize,color:_penColor,lines:lines})
+                            .then(function(annotation){
+                                if(path){svg.removeChild(path);}
+                                (0,_appendChild2.default)(svg,annotation);
+                            }, function (err){
+                                // Remove path
+                                if(path){svg.removeChild(path);}
+                                notification.addNotification({
+                                    message: M.util.get_string('error:addAnnotation','pdfannotator'),
+                                    type: "error"
+                                });
+                            });
+                }
+            }
+            function handeContentTouchcancel(e) {
+                document.documentElement.style.overflow = 'auto';
+                document.getElementById('content-wrapper').style.overflow = 'auto';
+                lines=null;
+                path.parentNode.removeChild(path);
+            }
+            /**
             * Set the attributes of the pen.
             *
             * @param {Number} penSize The size of the lines drawn by the pen
@@ -5515,9 +5554,14 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
                                return;
                            }
                            _enabled=true;
-                           document.getElementById('content-wrapper').classList.add('cursor-pen');
+                           var contentWrapper = document.getElementById('content-wrapper');
+                           contentWrapper.classList.add('cursor-pen');
                            document.addEventListener('mousedown',handleDocumentMousedown);
                            document.addEventListener('keyup',handleDocumentKeyup);
+                           contentWrapper.addEventListener('touchstart',handeContentTouchstart);
+                           contentWrapper.addEventListener('touchmove',handeContentTouchmove);
+                           contentWrapper.addEventListener('touchend',handeContentTouchend);
+                           contentWrapper.addEventListener('touchcancel',handeContentTouchcancel);
                            (0,_utils.disableUserSelect)();
                        }/**
             * Disable the pen behavior
@@ -5526,9 +5570,14 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
                                return;
                            }
                            _enabled=false;
-                           document.getElementById('content-wrapper').classList.remove('cursor-pen');
+                           var contentWrapper = document.getElementById('content-wrapper');
+                           contentWrapper.classList.remove('cursor-pen');
                            document.removeEventListener('mousedown',handleDocumentMousedown);
                            document.removeEventListener('keyup',handleDocumentKeyup);
+                           contentWrapper.removeEventListener('touchstart',handeContentTouchstart);
+                           contentWrapper.removeEventListener('touchmove',handeContentTouchmove);
+                           contentWrapper.removeEventListener('touchend',handeContentTouchend);
+                           contentWrapper.removeEventListener('touchcancel',handeContentTouchcancel);
                            (0,_utils.enableUserSelect)();
                        }
     /***/},