From ef47c0931ff94208e237334e8f6803498e5d25d0 Mon Sep 17 00:00:00 2001 From: Steven Spungin Date: Thu, 18 Jun 2015 09:12:33 -0400 Subject: [PATCH] Fix 'canvas not defined' issue https://github.com/MrRio/jsPDF/issues/503 --- libs/html2pdf.js | 2 +- libs/require/config.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/html2pdf.js b/libs/html2pdf.js index da22cc393..7c22e10d5 100644 --- a/libs/html2pdf.js +++ b/libs/html2pdf.js @@ -6,7 +6,7 @@ * http://opensource.org/licenses/mit-license */ -html2pdf = function(html,pdf,callback) { +function html2pdf (html,pdf,callback) { var canvas = pdf.canvas; if (!canvas) { alert('jsPDF canvas plugin not installed'); diff --git a/libs/require/config.js b/libs/require/config.js index 5918629e2..d61f0e79d 100644 --- a/libs/require/config.js +++ b/libs/require/config.js @@ -13,6 +13,9 @@ * This allows a host page to simply include require.js and bootstrap the page with a single require statement. */ +// Skip if Require.JS not installed +if (typeof require === 'object') { + if (typeof require_baseUrl_override === 'undefined'){ require_baseUrl_override = '../'; } @@ -113,3 +116,4 @@ require.config({ 'html2pdf': 'libs/html2pdf' } }); +} // Require.JS