From 8ce1d240ea1a8db585cfe7e904a88ceebb420a1e Mon Sep 17 00:00:00 2001
From: Yury Delendik <ydelendik@mozilla.com>
Date: Mon, 22 Sep 2014 16:26:39 -0500
Subject: [PATCH] PDF.js version 1.0.355

---
 bower.json            |  2 +-
 build/pdf.combined.js | 12 ++++++++++--
 build/pdf.js          | 12 ++++++++++--
 build/pdf.worker.js   |  4 ++--
 package.json          |  2 +-
 web/compatibility.js  |  9 +++++++++
 6 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/bower.json b/bower.json
index 162dab65f..af0740b6b 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
 {
   "name": "pdfjs-dist",
-  "version": "1.0.353",
+  "version": "1.0.355",
   "keywords": [
     "Mozilla",
     "pdf",
diff --git a/build/pdf.combined.js b/build/pdf.combined.js
index cacca859f..65c42b0e9 100644
--- a/build/pdf.combined.js
+++ b/build/pdf.combined.js
@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 
-PDFJS.version = '1.0.353';
-PDFJS.build = '480e093';
+PDFJS.version = '1.0.355';
+PDFJS.build = '2efbdfe';
 
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it
@@ -2481,6 +2481,14 @@ PDFJS.useOnlyCssZoom = (PDFJS.useOnlyCssZoom === undefined ?
 PDFJS.verbosity = (PDFJS.verbosity === undefined ?
                    PDFJS.VERBOSITY_LEVELS.warnings : PDFJS.verbosity);
 
+/**
+ * The maximum supported canvas size in total pixels e.g. width * height. 
+ * The default value is 4096 * 4096. Use -1 for no limit.
+ * @var {number}
+ */
+PDFJS.maxCanvasPixels = (PDFJS.maxCanvasPixels === undefined ?
+                         16777216 : PDFJS.maxCanvasPixels);
+
 /**
  * Document initialization / loading parameters object.
  *
diff --git a/build/pdf.js b/build/pdf.js
index 315751e89..c2dbb2f0f 100644
--- a/build/pdf.js
+++ b/build/pdf.js
@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 
-PDFJS.version = '1.0.353';
-PDFJS.build = '480e093';
+PDFJS.version = '1.0.355';
+PDFJS.build = '2efbdfe';
 
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it
@@ -2481,6 +2481,14 @@ PDFJS.useOnlyCssZoom = (PDFJS.useOnlyCssZoom === undefined ?
 PDFJS.verbosity = (PDFJS.verbosity === undefined ?
                    PDFJS.VERBOSITY_LEVELS.warnings : PDFJS.verbosity);
 
+/**
+ * The maximum supported canvas size in total pixels e.g. width * height. 
+ * The default value is 4096 * 4096. Use -1 for no limit.
+ * @var {number}
+ */
+PDFJS.maxCanvasPixels = (PDFJS.maxCanvasPixels === undefined ?
+                         16777216 : PDFJS.maxCanvasPixels);
+
 /**
  * Document initialization / loading parameters object.
  *
diff --git a/build/pdf.worker.js b/build/pdf.worker.js
index b750d7862..97364b01c 100644
--- a/build/pdf.worker.js
+++ b/build/pdf.worker.js
@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 
-PDFJS.version = '1.0.353';
-PDFJS.build = '480e093';
+PDFJS.version = '1.0.355';
+PDFJS.build = '2efbdfe';
 
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it
diff --git a/package.json b/package.json
index efa668056..b0794e73d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "pdfjs-dist",
-  "version": "1.0.353",
+  "version": "1.0.355",
   "description": "Generic build of Mozilla's PDF.js library.",
   "keywords": [
     "Mozilla",
diff --git a/web/compatibility.js b/web/compatibility.js
index c39162cbf..b603971e3 100644
--- a/web/compatibility.js
+++ b/web/compatibility.js
@@ -507,3 +507,12 @@ if (typeof PDFJS === 'undefined') {
       window.setTimeout(callback, 20);
     });
 })();
+
+(function checkCanvasSizeLimitation() {
+  var isIOS = /(iPad|iPhone|iPod)/g.test(navigator.userAgent);
+  var isAndroid = /Android/g.test(navigator.userAgent);
+  if (isIOS || isAndroid) {
+    // 5MP
+    PDFJS.maxCanvasPixels = 5242880;
+  }
+})();