我正在开发一个 angular_js / spring web-app。我正在使用 pdftron 库来查看 pdf 文件并将其存储到 indexedDB 以使用离线模式。
我在我的项目中导入了一个 pdftorn 库,并且存在 CoreControls 文件。这是我的 common.js:
'use strict';
requirejs.config({
"baseUrl": CDN_CONTEXT_PATH,
paths: {
"jquery": 'jquery/1.11.3/jquery.min',
"jquery-ui": 'jquery-ui/1.11.4',
"jquery-layout": 'jquery-layout/1.4.3/jquery.layout_and_plugins.min',
"jquery-fullscreen": 'jquery-fullscreen/1.1.5/jquery.fullscreen',
"handlebars": 'handlebars/1.3.0/handlebars',
"bootstrap": 'bootstrap/'+ CDN_BOOTSTRAP_VERSION +'/js/bootstrap',
"text": 'requirejs-text/2.0.14/text',
"angular": "angularjs/1.5.5/angular.min",
"angular-route": "angularjs/1.5.5/angular-route.min",
"angular-touch": "angularjs/1.5.5/angular-touch.min",
"angular-animate": "angularjs/1.5.5/angular-animate.min",
"pdftron": 'pdftron/'+ CDN_PDFTRON_VERSION +'/lib/WebViewer.min',
"core-controls": 'pdftron/'+ CDN_PDFTRON_VERSION +'/lib/html5/CoreControls.js'
},
shim: {
"bootstrap": {
deps: ['jquery']
},
"angular": {
exports: 'angular',
deps: ['jquery']
},
"angular-route": {
deps: ['angular']
},
"angular-touch": {
deps: ['angular']
},
"angular-animate": {
deps: ['angular']
},
"handlebars": {
exports: 'Handlebars'
},
'pdftron': {
exports: 'PDFTron',
deps: ['jquery']
},
'jquery-layout': {
deps: ['jquery']
},
'jquery-fullscreen': {
deps: ['jquery']
}
},
config: {
moment: {
noGlobal: true
}
}
});
这是我的定义控制器:
define(['angular', 'angular-touch', 'pdftron', 'core-controls'], function(angular, pdftron, core-controls) {
var appControllers = angular.module('mbControllers', ['ngTouch']);
这就是我使用它的地方:
function storeOffline(docInfo, onComplete) {
console.log("storeOFFLINE");
var cacheHinting = CoreControls.PartRetrievers.CacheHinting;
var partRetriever = new CoreControls.PartRetrievers.StreamingPartRetriever(docInfo.location, cacheHinting.CACHE);
var doc = new CoreControls.Document(docInfo.id);
doc.loadAsync(partRetriever, function(err) {
if (err) {
onComplete(err);
return;
}
doc.initOfflineDB(function() {
doc.storeOffline(function() {
onComplete();
});
});
});
}
这是铬输出:
angular.js:13550 ReferenceError:CoreControls 未定义
有什么建议吗?
谢谢。