mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-21 15:48:06 +02:00
Merge pull request #6771 from yurydelendik/requirejs
Removes hardcoded module loading order
This commit is contained in:
commit
e8db825512
25 changed files with 363 additions and 530 deletions
|
@ -36,8 +36,6 @@ var TEXT_LAYER_RENDER_DELAY = 200; // ms
|
|||
* @implements {IRenderableView}
|
||||
*/
|
||||
var PDFPageView = (function PDFPageViewClosure() {
|
||||
var CustomStyle = PDFJS.CustomStyle;
|
||||
|
||||
/**
|
||||
* @constructs PDFPageView
|
||||
* @param {PDFPageViewOptions} options
|
||||
|
@ -211,6 +209,8 @@ var PDFPageView = (function PDFPageViewClosure() {
|
|||
},
|
||||
|
||||
cssTransform: function PDFPageView_transform(canvas, redrawAnnotations) {
|
||||
var CustomStyle = PDFJS.CustomStyle;
|
||||
|
||||
// Scale canvas, canvas wrapper, and page container.
|
||||
var width = this.viewport.width;
|
||||
var height = this.viewport.height;
|
||||
|
@ -518,6 +518,7 @@ var PDFPageView = (function PDFPageViewClosure() {
|
|||
},
|
||||
|
||||
beforePrint: function PDFPageView_beforePrint() {
|
||||
var CustomStyle = PDFJS.CustomStyle;
|
||||
var pdfPage = this.pdfPage;
|
||||
|
||||
var viewport = pdfPage.getViewport(1);
|
||||
|
|
|
@ -53,18 +53,7 @@ See https://github.com/adobe-type-tools/cmap-resources
|
|||
<!--#endif-->
|
||||
|
||||
<!--#if !PRODUCTION-->
|
||||
<script src="../src/shared/global.js"></script>
|
||||
<script src="../src/display/dom_utils.js"></script>
|
||||
<script src="../src/shared/util.js"></script>
|
||||
<script src="../src/display/annotation_layer.js"></script>
|
||||
<script src="../src/display/font_loader.js"></script>
|
||||
<script src="../src/display/metadata.js"></script>
|
||||
<script src="../src/display/text_layer.js"></script>
|
||||
<script src="../src/display/webgl.js"></script>
|
||||
<script src="../src/display/pattern_helper.js"></script>
|
||||
<script src="../src/display/canvas.js"></script>
|
||||
<script src="../src/display/api.js"></script>
|
||||
<script>PDFJS.workerSrc = '../src/worker_loader.js';</script>
|
||||
<script src="../node_modules/requirejs/require.js"></script>
|
||||
<!--#endif-->
|
||||
|
||||
<!--#if (GENERIC && !MINIFIED) -->
|
||||
|
|
|
@ -34,17 +34,20 @@ var SCALE_SELECT_PADDING = 22;
|
|||
var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading';
|
||||
var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000;
|
||||
|
||||
PDFJS.imageResourcesPath = './images/';
|
||||
function configure(PDFJS) {
|
||||
PDFJS.imageResourcesPath = './images/';
|
||||
//#if (FIREFOX || MOZCENTRAL || GENERIC || CHROME)
|
||||
//PDFJS.workerSrc = '../build/pdf.worker.js';
|
||||
//#endif
|
||||
//#if !PRODUCTION
|
||||
PDFJS.cMapUrl = '../external/bcmaps/';
|
||||
PDFJS.cMapPacked = true;
|
||||
PDFJS.cMapUrl = '../external/bcmaps/';
|
||||
PDFJS.cMapPacked = true;
|
||||
PDFJS.workerSrc = '../src/worker_loader.js';
|
||||
//#else
|
||||
//PDFJS.cMapUrl = '../web/cmaps/';
|
||||
//PDFJS.cMapPacked = true;
|
||||
//#endif
|
||||
}
|
||||
|
||||
var mozL10n = document.mozL10n || document.webL10n;
|
||||
|
||||
|
@ -1330,7 +1333,20 @@ window.PDFView = PDFViewerApplication; // obsolete name, using it as an alias
|
|||
//#endif
|
||||
|
||||
function webViewerLoad(evt) {
|
||||
PDFViewerApplication.initialize().then(webViewerInitialized);
|
||||
//#if !PRODUCTION
|
||||
require.config({paths: {'pdfjs': '../src'}});
|
||||
require(['pdfjs/display/api',
|
||||
'pdfjs/display/annotation_layer',
|
||||
'pdfjs/display/text_layer',
|
||||
'pdfjs/display/metadata'],
|
||||
function (api, annotationLayer, textLayer, metadata) {
|
||||
configure(PDFJS);
|
||||
PDFViewerApplication.initialize().then(webViewerInitialized);
|
||||
});
|
||||
//#else
|
||||
// configure(PDFJS);
|
||||
// PDFViewerApplication.initialize().then(webViewerInitialized);
|
||||
//#endif
|
||||
}
|
||||
|
||||
function webViewerInitialized() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue