Merge pull request #6683 from yurydelendik/module-core

Adds UMD headers to core, display and shared files.
This commit is contained in:
Brendan Dahl 2015-12-15 17:10:21 -08:00
commit f1c64b6a2a
56 changed files with 2433 additions and 574 deletions

View File

@ -3,6 +3,12 @@
"browser": true,
"devel": true,
"worker": true,
"predef": [
"Promise",
"require",
"define",
"exports"
],
// Enforcing
"maxlen": 80,

View File

@ -4,17 +4,17 @@
<head>
<!-- In production, only one script (pdf.js) is necessary -->
<!-- In production, change the content of PDFJS.workerSrc below -->
<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/api.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/canvas.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/font_loader.js"></script>
<script src="../../src/display/dom_utils.js"></script>
<script src="../../src/display/annotation_layer.js"></script>
<script src="../../src/display/text_layer.js"></script>
<script src="../../src/display/canvas.js"></script>
<script src="../../src/display/api.js"></script>
<script>
// Specify the main script used to create a new PDF.JS web worker.
// In production, change this to point to the combined `pdf.js` file.

View File

@ -4,16 +4,17 @@
<head>
<!-- In production, only one script (pdf.js) is necessary -->
<!-- In production, change the content of PDFJS.workerSrc below -->
<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/api.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/canvas.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/font_loader.js"></script>
<script src="../../src/display/dom_utils.js"></script>
<script src="../../src/display/annotation_layer.js"></script>
<script src="../../src/display/text_layer.js"></script>
<script src="../../src/display/canvas.js"></script>
<script src="../../src/display/api.js"></script>
<script>
// Specify the main script used to create a new PDF.JS web worker.

View File

@ -4,12 +4,15 @@
<head>
<!-- In production, only one script (pdf.js) is necessary -->
<!-- In production, change the content of PDFJS.workerSrc below -->
<script src="../../src/shared/global.js"></script>
<script src="../../src/shared/util.js"></script>
<script src="../../src/display/api.js"></script>
<script src="../../src/display/metadata.js"></script>
<script src="../../src/display/pattern_helper.js"></script>
<script src="../../src/display/font_loader.js"></script>
<script src="../../src/display/metadata.js"></script>
<script src="../../src/display/svg.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>
// Specify the main script used to create a new PDF.JS web worker.

51
external/umdutils/genhtml.js vendored Normal file
View File

@ -0,0 +1,51 @@
/* Copyright 2015 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint node:true */
'use strict';
// Simple util to re-generate HTML module references in right load order.
var fs = require('fs');
var path = require('path');
var umd = require('./verifier.js');
var filePath = process.argv[2];
if (!filePath) {
console.log('USAGE: node ./external/umdutils/genhtml.js <html-file-path>');
process.exit(0);
}
var content = fs.readFileSync(filePath).toString();
var m, re = /<script\s+src=['"]([^'"]+)/g;
var filesFound = [];
while ((m = re.exec(content))) {
var jsPath = m[1];
if (!/\bsrc\/.*?\.js$/.test(jsPath)) {
continue;
}
filesFound.push(jsPath);
}
var srcPrefix = filesFound[0].substring(0, filesFound[0].indexOf('src/') + 4);
var dependencies = umd.readDependencies(filesFound.map(function (p) {
return path.join(path.dirname(filePath), p);
}));
dependencies.loadOrder.forEach(function (i) {
console.log('<script src="' + i.replace('pdfjs/', srcPrefix) + '.js">'+
'</script>');
});

488
external/umdutils/verifier.js vendored Normal file
View File

@ -0,0 +1,488 @@
/* Copyright 2015 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
/* Utilities for parsing PDF.js UMD file format. A UMD header of the file
* shall conform the following rules:
* 1. Names of AMD modules and JavaScript object placed to the global object
* shall be alike: symbols'/' and '_' removed, and character case is
* ignored.
* 2. CommonJS require shall use relative path to the required module, e.g.
* './display.js' or '../shared/util.js', and they shall construct the
* similar name to AMD one.
* 3. Factory function shall contain names for modules, not less than listed
* in AMD, CommonJS or global object properties list, and also their
* names must be alike to name of the root object properties.
*
* Example:
*
* (function (root, factory) {
* if (typeof define === 'function' && define.amd) {
* define('pdfjs/display/pattern_helper', ['exports', 'pdfjs/shared/util',
* 'pdfjs/display/webgl'], factory);
* } else if (typeof exports !== 'undefined') {
* factory(exports, require('../shared/util.js'), require('./webgl.js'));
* } else {
* factory((root.pdfjsDisplayPatternHelper = {}), root.pdfjsSharedUtil,
* root.pdfjsDisplayWebGL);
* }
* }(this, function (exports, sharedUtil, displayWebGL) {
*
*/
var fs = require('fs');
var path = require('path');
/**
* Parses PDF.js UMD header.
* @param {string} filePath PDF.js JavaScript file path.
* @returns {{amdId: *, amdImports: Array, cjsRequires: Array, jsRootName: *,
* jsImports: Array, imports: Array, importedNames: Array,
* exportedNames: Array, body: *}}
*/
function parseUmd(filePath) {
var jscode = fs.readFileSync(filePath).toString();
// Extracts header and body.
var umdStart = '\\(function\\s\\(root,\\sfactory\\)\\s\\{';
var umdImports = '\\}\\(this,\\sfunction\\s\\(exports\\b';
var umdBody = '\\)\\s\\{';
var umdEnd = '\\}\\)\\);\\s*$';
var m, re;
m = new RegExp(umdStart + '([\\s\\S]*?)' + umdImports + '([\\s\\S]*?)' +
umdBody + '([\\s\\S]*?)' + umdEnd).exec(jscode);
if (!m) {
throw new Error('UMD was not found');
}
var header = m[1];
var imports = m[2].replace(/\s+/g, '').split(',');
imports.shift(); // avoiding only-export case
var body = m[3];
// Extracts AMD definitions.
var amdMatch = /\bdefine\('([^']*)',\s\[([^\]]*)\],\s+factory\);/.
exec(header);
if (!amdMatch) {
throw new Error('AMD call was not found');
}
var amdId = amdMatch[1];
var amdImports = amdMatch[2].replace(/[\s']+/g, '').split(',');
if (amdImports[0] !== 'exports') {
throw new Error('exports expected first at AMD call');
}
amdImports.shift();
// Extracts CommonJS definitions.
var cjsMatch = /\bfactory\(exports((?:,\s+require\([^\)]+\))*)\);/.
exec(header);
if (!cjsMatch) {
throw new Error('CommonJS call was not found');
}
var cjsRequires = cjsMatch[1].replace(/\s+/g, ' ').trim().
replace(/\s*require\('([^']*)'\)/g, '$1').split(',');
cjsRequires.shift();
var jsMatch = /\bfactory\(\(root\.(\S+)\s=\s\{\}\)((?:,\s+root\.\S+)*)\);/.
exec(header);
if (!jsMatch) {
throw new Error('Regular JS call was not found');
}
// Extracts global object properties definitions.
var jsRootName = jsMatch[1];
var jsImports = jsMatch[2].replace(/\s+/g, '').split(',');
jsImports.shift();
// Scans for imports usages in the body.
var importedNames = [];
if (imports.length > 0) {
re = new RegExp('\\b(' + imports.join('|') + ')\\.(\\w+)', 'g');
while ((m = re.exec(body))) {
importedNames.push(m[0]);
}
}
importedNames.sort();
for (var i = importedNames.length - 1; i > 0; i--) {
if (importedNames[i - 1] === importedNames[i]) {
importedNames.splice(i, 1);
}
}
// Scans for exports definitions in the body.
var exportedNames = [];
re = /\bexports.(\w+)\s*=\s/g;
while ((m = re.exec(body))) {
exportedNames.push(m[1]);
}
return {
amdId: amdId,
amdImports: amdImports,
cjsRequires: cjsRequires,
jsRootName: jsRootName,
jsImports: jsImports,
imports: imports,
importedNames: importedNames,
exportedNames: exportedNames,
body: body
};
}
/**
* Reads and parses all JavaScript root files dependencies and calculates
* evaluation/load order.
* @param {Array} rootPaths Array of the paths for JavaScript files.
* @returns {{modules: null, loadOrder: Array}}
*/
function readDependencies(rootPaths) {
// Reading of dependencies.
var modules = Object.create(null);
var processed = Object.create(null);
var queue = [];
rootPaths.forEach(function (i) {
if (processed[i]) {
return;
}
queue.push(i);
processed[i] = true;
});
while (queue.length > 0) {
var p = queue.shift();
var umd;
try {
umd = parseUmd(p);
} catch (_) {
// Ignoring bad UMD modules.
continue;
}
modules[umd.amdId] = {
dependencies: umd.amdImports
};
umd.cjsRequires.forEach(function (r) {
if (r[0] !== '.' || !/\.js$/.test(r)) {
return; // not pdfjs module
}
var dependencyPath = path.join(path.dirname(p), r);
if (processed[dependencyPath]) {
return;
}
queue.push(dependencyPath);
processed[dependencyPath] = true;
});
}
// Topological sorting, somewhat Kahn's algorithm but sorts found nodes at
// each iteration.
processed = Object.create(null);
var left = [], result = [];
for (var i in modules) {
var hasDependencies = modules[i].dependencies.length > 0;
if (hasDependencies) {
left.push(i);
} else {
processed[i] = true;
result.push(i);
}
}
result.sort();
while (left.length > 0) {
var discovered = [];
left.forEach(function (i) {
// Finding if we did not process all dependencies for current module yet.
var hasDependecies = modules[i].dependencies.some(function (j) {
return !processed[j] && !!modules[j];
});
if (!hasDependecies) {
discovered.push(i);
}
});
if (discovered.length === 0) {
throw new Error ('Some circular references exist: somewhere at ' +
left.join(','));
}
discovered.sort();
discovered.forEach(function (i) {
result.push(i);
left.splice(left.indexOf(i), 1);
processed[i] = true;
});
}
return {modules: modules, loadOrder: result};
}
/**
* Validates individual file. See rules above.
*/
function validateFile(path, name, context) {
function info(msg) {
context.infoCallback(path + ': ' + msg);
}
function warn(msg) {
context.warnCallback(path + ': ' + msg);
}
function error(msg) {
context.errorCallback(path + ': ' + msg);
}
try {
var umd = parseUmd(path);
info('found ' + umd.amdId);
if (name !== umd.amdId) {
error('AMD name does not match module name');
}
if (name.replace(/[_\/]/g, '') !== umd.jsRootName.toLowerCase()) {
error('root name does not look like module name');
}
if (umd.amdImports.length > umd.imports.length) {
error('AMD imports has more entries than body imports');
}
if (umd.cjsRequires.length > umd.imports.length) {
error('CommonJS imports has more entries than body imports');
}
if (umd.jsImports.length > umd.imports.length) {
error('JS imports has more entries than body imports');
}
var optionalArgs = umd.imports.length - Math.min(umd.amdImports.length,
umd.cjsRequires.length, umd.jsImports.length);
if (optionalArgs > 0) {
warn('' + optionalArgs + ' optional args found: ' +
umd.imports.slice(-optionalArgs));
}
umd.jsImports.forEach(function (i, index) {
if (i.indexOf('root.') !== 0) {
if (index >= umd.jsImports.length - optionalArgs) {
warn('Non-optional non-root based JS import: ' + i);
}
return;
}
i = i.substring('root.'.length);
var j = umd.imports[index];
var offset = i.toLowerCase().lastIndexOf(j.toLowerCase());
if (offset + j.length !== i.length) {
error('JS import name does not look like corresponding body import ' +
'name: ' + i + ' vs ' + j);
}
j = umd.amdImports[index];
if (j) {
if (j.replace(/[_\/]/g, '') !== i.toLowerCase()) {
error('JS import name does not look like corresponding AMD import ' +
'name: ' + i + ' vs ' + j);
}
}
});
umd.cjsRequires.forEach(function (i, index) {
var j = umd.amdImports[index];
if (!j) {
return; // optional
}
var noExtension = i.replace(/\.js$/, '');
if (noExtension === i || i[0] !== '.') {
warn('CommonJS shall have relative path and extension: ' + i);
return;
}
var base = name.split('/');
base.pop();
var parts = noExtension.split('/');
if (parts[0] === '.') {
parts.shift();
}
while (parts[0] === '..') {
parts.shift();
base.pop();
}
if (j !== base.concat(parts).join('/')) {
error('CommonJS path does not point to right AMD module: ' +
i + ' vs ' + j);
}
});
umd.imports.forEach(function (i) {
var prefix = i + '.';
if (umd.importedNames.every(function (j) {
return j.indexOf(prefix) !== 0;
})) {
warn('import is not used to import names: ' + i);
}
});
// Recording the module exports and imports for further validation.
// See validateImports and validateDependencies below.
context.exports[name] = Object.create(null);
umd.exportedNames.forEach(function (i) {
context.exports[name][i] = true;
});
context.dependencies[name] = umd.amdImports;
umd.importedNames.forEach(function (i) {
var parts = i.split('.');
var index = umd.imports.indexOf(parts[0]);
if (index < 0 || !umd.amdImports[index]) {
return; // some optional arg and not in AMD list?
}
var refModuleName = umd.amdImports[index];
var fromModule = context.imports[refModuleName];
if (!fromModule) {
context.imports[refModuleName] = (fromModule = Object.create(null));
}
var symbolRefs = fromModule[parts[1]];
if (!symbolRefs) {
fromModule[parts[1]] = (symbolRefs = []);
}
symbolRefs.push(name);
});
} catch (e) {
warn(e.message);
}
}
function findFilesInDirectory(dirPath, name, foundFiles) {
fs.readdirSync(dirPath).forEach(function (file) {
var filePath = dirPath + '/' + file;
var stats = fs.statSync(filePath);
if (stats.isFile() && /\.js$/i.test(file)) {
var fileName = file.substring(0, file.lastIndexOf('.'));
foundFiles.push({path: filePath, name: name + '/' + fileName});
} else if (stats.isDirectory() && /^\w+$/.test(file)) {
findFilesInDirectory(filePath, name + '/' + file, foundFiles);
}
});
}
function validateImports(context) {
// Checks if some non-exported symbol was imported.
for (var i in context.imports) {
var exportedSymbols = context.exports[i];
if (!exportedSymbols) {
context.warnCallback('Exported symbols don\'t exist for: ' + i);
continue;
}
var importedSymbols = context.imports[i];
for (var j in importedSymbols) {
if (!(j in exportedSymbols)) {
context.errorCallback('The non-exported symbol is referred: ' + j +
' from ' + i + ' used in ' + importedSymbols[j]);
}
}
}
}
function validateDependencies(context) {
// Checks for circular dependency (non-efficient algorithm but does the work).
var nonRoots = Object.create(null);
var i, j, item;
for (i in context.dependencies) {
var checked = Object.create(null);
var queue = [[i]];
while (queue.length > 0) {
item = queue.shift();
j = item[0];
var dependencies = context.dependencies[j];
dependencies.forEach(function (q) {
if (!(q in context.dependencies)) {
context.warnCallback('Unknown dependency: ' + q);
return;
}
var index = item.indexOf(q);
if (index >= 0) {
context.errorCallback('Circular dependency was found: ' +
item.slice(0, index + 1).join('<-'));
return;
}
if (q in checked) {
return;
}
queue.push([q].concat(item));
checked[q] = i;
nonRoots[q] = true;
});
}
}
// Some root modules info.
for (i in context.dependencies) {
if (!(i in nonRoots)) {
context.infoCallback('Root module: ' + i);
}
}}
/**
* Validates all modules/files in the specified path. The modules must be
* defined using PDF.js UMD format. Results printed to console.
* @param {Object} paths The map of the module path prefixes to file/directory
* location.
* @param {Object} options (optional) options for validation.
* @returns {boolean} true if no error was found.
*/
function validateFiles(paths, options) {
options = options || {};
var verbosity = options.verbosity === undefined ? 0 : options.verbosity;
var wasErrorFound = false;
var errorCallback = function (msg) {
if (verbosity >= 0) {
console.error('ERROR:' + msg);
}
wasErrorFound = true;
};
var warnCallback = function (msg) {
if (verbosity >= 1) {
console.warn('WARNING: ' + msg);
}
};
var infoCallback = function (msg) {
if (verbosity >= 5) {
console.info('INFO: ' + msg);
}
};
// Finds all files.
for (var name in paths) {
if (!paths.hasOwnProperty(name)) {
continue;
}
var path = paths[name];
var stats = fs.statSync(path);
var foundFiles = [];
if (stats.isFile()) {
foundFiles.push({path: path, name: name});
} else if (stats.isDirectory()) {
findFilesInDirectory(path, name, foundFiles);
}
}
var context = {
exports: Object.create(null),
imports: Object.create(null),
dependencies: Object.create(null),
errorCallback: errorCallback,
warnCallback: warnCallback,
infoCallback: infoCallback
};
foundFiles.forEach(function (pair) {
validateFile(pair.path, pair.name, context);
});
validateImports(context);
validateDependencies(context);
return !wasErrorFound;
}
exports.parseUmd = parseUmd;
exports.readDependencies = readDependencies;
exports.validateFiles = validateFiles;

22
make.js
View File

@ -520,19 +520,20 @@ target.bundle = function(args) {
}
var SHARED_SRC_FILES = [
'shared/util.js',
'shared/global.js',
'shared/util.js'
];
var MAIN_SRC_FILES = SHARED_SRC_FILES.concat([
'display/api.js',
'display/metadata.js',
'display/canvas.js',
'display/webgl.js',
'display/pattern_helper.js',
'display/font_loader.js',
'display/dom_utils.js',
'display/annotation_layer.js',
'display/font_loader.js',
'display/metadata.js',
'display/text_layer.js',
'display/webgl.js',
'display/pattern_helper.js',
'display/canvas.js',
'display/api.js',
'display/svg.js'
]);
@ -1496,6 +1497,13 @@ target.lint = function() {
exit(1);
}
echo();
echo('### Checking UMD dependencies');
var umd = require('./external/umdutils/verifier.js');
if (!umd.validateFiles({'pdfjs': './src'})) {
exit(1);
}
echo('files checked, no errors found');
};

View File

@ -12,13 +12,48 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFJS, Util, isDict, isName, stringToPDFString, warn, Dict, Stream,
stringToBytes, Promise, isArray, ObjectLoader, OperatorList,
isValidUrl, OPS, AnnotationType, stringToUTF8String,
AnnotationBorderStyleType, ColorSpace, AnnotationFlag, isInt */
/* globals PDFJS */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/annotation', ['exports', 'pdfjs/shared/util',
'pdfjs/core/primitives', 'pdfjs/core/stream', 'pdfjs/core/colorspace',
'pdfjs/core/obj', 'pdfjs/core/evaluator'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./primitives.js'),
require('./stream.js'), require('./colorspace.js'), require('./obj.js'),
require('./evaluator.js'));
} else {
factory((root.pdfjsCoreAnnotation = {}), root.pdfjsSharedUtil,
root.pdfjsCorePrimitives, root.pdfjsCoreStream, root.pdfjsCoreColorSpace,
root.pdfjsCoreObj, root.pdfjsCoreEvaluator);
}
}(this, function (exports, sharedUtil, corePrimitives, coreStream,
coreColorSpace, coreObj, coreEvaluator) {
var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType;
var AnnotationFlag = sharedUtil.AnnotationFlag;
var AnnotationType = sharedUtil.AnnotationType;
var OPS = sharedUtil.OPS;
var Util = sharedUtil.Util;
var isArray = sharedUtil.isArray;
var isInt = sharedUtil.isInt;
var isValidUrl = sharedUtil.isValidUrl;
var stringToBytes = sharedUtil.stringToBytes;
var stringToPDFString = sharedUtil.stringToPDFString;
var stringToUTF8String = sharedUtil.stringToUTF8String;
var warn = sharedUtil.warn;
var Dict = corePrimitives.Dict;
var Name = corePrimitives.Name;
var isDict = corePrimitives.isDict;
var isName = corePrimitives.isName;
var Stream = coreStream.Stream;
var ColorSpace = coreColorSpace.ColorSpace;
var ObjectLoader = coreObj.ObjectLoader;
var OperatorList = coreEvaluator.OperatorList;
var DEFAULT_ICON_SIZE = 22; // px
/**
@ -712,3 +747,8 @@ var LinkAnnotation = (function LinkAnnotationClosure() {
return LinkAnnotation;
})();
exports.Annotation = Annotation;
exports.AnnotationBorderStyle = AnnotationBorderStyle;
exports.AnnotationFactory = AnnotationFactory;
}));

View File

@ -15,6 +15,16 @@
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/arithmetic_decoder', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsCoreArithmeticDecoder = {}));
}
}(this, function (exports) {
/* This class implements the QM Coder decoding as defined in
* JPEG 2000 Part I Final Committee Draft Version 1.0
* Annex C.3 Arithmetic decoding procedure
@ -181,3 +191,6 @@ var ArithmeticDecoder = (function ArithmeticDecoderClosure() {
return ArithmeticDecoder;
})();
exports.ArithmeticDecoder = ArithmeticDecoder;
}));

View File

@ -12,10 +12,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFJS */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/bidi', ['exports', 'pdfjs/shared/global'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/global.js'));
} else {
factory((root.pdfjsCoreBidi = {}), root.pdfjsSharedGlobal);
}
}(this, function (exports, sharedGlobal) {
var PDFJS = sharedGlobal.PDFJS;
var bidi = PDFJS.bidi = (function bidiClosure() {
// Character types for symbols from 0000 to 00FF.
var baseTypes = [
@ -421,3 +432,6 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
return bidi;
})();
exports.bidi = bidi;
}));

View File

@ -15,6 +15,16 @@
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/charsets', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsCoreCharsets = {}));
}
}(this, function (exports) {
var ISOAdobeCharset = [
'.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar',
'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright',
@ -114,3 +124,8 @@ var ExpertSubsetCharset = [
'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior',
'periodinferior', 'commainferior'
];
exports.ISOAdobeCharset = ISOAdobeCharset;
exports.ExpertCharset = ExpertCharset;
exports.ExpertSubsetCharset = ExpertSubsetCharset;
}));

View File

@ -12,11 +12,27 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals assert, MissingDataException, isInt, NetworkManager, Promise,
isEmptyObj, createPromiseCapability */
/* globals NetworkManager */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/chunked_stream', ['exports', 'pdfjs/shared/util'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'));
} else {
factory((root.pdfjsCoreChunkedStream = {}), root.pdfjsSharedUtil);
}
}(this, function (exports, sharedUtil) {
var MissingDataException = sharedUtil.MissingDataException;
var assert = sharedUtil.assert;
var createPromiseCapability = sharedUtil.createPromiseCapability;
var isInt = sharedUtil.isInt;
var isEmptyObj = sharedUtil.isEmptyObj;
var ChunkedStream = (function ChunkedStreamClosure() {
function ChunkedStream(length, chunkSize, manager) {
this.bytes = new Uint8Array(length);
@ -545,3 +561,7 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
return ChunkedStreamManager;
})();
exports.ChunkedStream = ChunkedStream;
exports.ChunkedStreamManager = ChunkedStreamManager;
}));

View File

@ -12,11 +12,37 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals Util, isString, isInt, warn, error, isCmd, isEOF, isName, Lexer,
isStream, StringStream, PDFJS, assert */
/* globals PDFJS */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/cmap', ['exports', 'pdfjs/shared/util',
'pdfjs/core/primitives', 'pdfjs/core/stream', 'pdfjs/core/parser'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./primitives.js'),
require('./stream.js'), require('./parser.js'));
} else {
factory((root.pdfjsCoreCMap = {}), root.pdfjsSharedUtil,
root.pdfjsCorePrimitives, root.pdfjsCoreStream, root.pdfjsCoreParser);
}
}(this, function (exports, sharedUtil, corePrimitives, coreStream, coreParser) {
var Util = sharedUtil.Util;
var assert = sharedUtil.assert;
var error = sharedUtil.error;
var isInt = sharedUtil.isInt;
var isString = sharedUtil.isString;
var warn = sharedUtil.warn;
var isName = corePrimitives.isName;
var isCmd = corePrimitives.isCmd;
var isStream = corePrimitives.isStream;
var StringStream = coreStream.StringStream;
var Lexer = coreParser.Lexer;
var isEOF = coreParser.isEOF;
var BUILT_IN_CMAPS = [
// << Start unicode maps.
'Adobe-GB1-UCS2',
@ -992,3 +1018,8 @@ var CMapFactory = (function CMapFactoryClosure() {
}
};
})();
exports.CMap = CMap;
exports.CMapFactory = CMapFactory;
exports.IdentityCMap = IdentityCMap;
}));

View File

@ -12,11 +12,38 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals error, info, isArray, isDict, isName, isStream, isString,
PDFFunction, PDFImage, shadow, warn */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/colorspace', ['exports', 'pdfjs/shared/util',
'pdfjs/core/primitives', 'pdfjs/core/function', 'pdfjs/core/stream'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./primitives.js'),
require('./function.js'), require('./stream.js'));
} else {
factory((root.pdfjsCoreColorSpace = {}), root.pdfjsSharedUtil,
root.pdfjsCorePrimitives, root.pdfjsCoreFunction, root.pdfjsCoreStream);
}
}(this, function (exports, sharedUtil, corePrimitives, coreFunction,
coreStream) {
var error = sharedUtil.error;
var info = sharedUtil.info;
var isArray = sharedUtil.isArray;
var isString = sharedUtil.isString;
var shadow = sharedUtil.shadow;
var warn = sharedUtil.warn;
var isDict = corePrimitives.isDict;
var isName = corePrimitives.isName;
var isStream = corePrimitives.isStream;
var PDFFunction = coreFunction.PDFFunction;
var coreImage; // see _setCoreImage below
var PDFImage; // = coreImage.PDFImage;
var ColorSpace = (function ColorSpaceClosure() {
// Constructor should define this.numComps, this.defaultColor, this.name
function ColorSpace() {
@ -1253,3 +1280,16 @@ var LabCS = (function LabCSClosure() {
};
return LabCS;
})();
// TODO refactor to remove dependency on image.js
function _setCoreImage(coreImage_) {
coreImage = coreImage_;
PDFImage = coreImage_.PDFImage;
}
exports._setCoreImage = _setCoreImage;
exports.ColorSpace = ColorSpace;
// TODO refactor to remove dependency on colorspace.js
coreStream._setCoreColorSpace(exports);
}));

View File

@ -12,12 +12,34 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals bytesToString, DecryptStream, error, isInt, isName, Name,
PasswordException, PasswordResponses, stringToBytes, warn,
utf8StringToString */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/crypto', ['exports', 'pdfjs/shared/util',
'pdfjs/core/primitives', 'pdfjs/core/stream'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./primitives.js'),
require('./stream.js'));
} else {
factory((root.pdfjsCoreCrypto = {}), root.pdfjsSharedUtil,
root.pdfjsCorePrimitives, root.pdfjsCoreStream);
}
}(this, function (exports, sharedUtil, corePrimitives, coreStream) {
var PasswordException = sharedUtil.PasswordException;
var PasswordResponses = sharedUtil.PasswordResponses;
var bytesToString = sharedUtil.bytesToString;
var error = sharedUtil.error;
var isInt = sharedUtil.isInt;
var stringToBytes = sharedUtil.stringToBytes;
var utf8StringToString = sharedUtil.utf8StringToString;
var warn = sharedUtil.warn;
var Name = corePrimitives.Name;
var isName = corePrimitives.isName;
var DecryptStream = coreStream.DecryptStream;
var ARCFourCipher = (function ARCFourCipherClosure() {
function ARCFourCipher(key) {
this.a = 0;
@ -2049,3 +2071,15 @@ var CipherTransformFactory = (function CipherTransformFactoryClosure() {
return CipherTransformFactory;
})();
exports.AES128Cipher = AES128Cipher;
exports.AES256Cipher = AES256Cipher;
exports.ARCFourCipher = ARCFourCipher;
exports.CipherTransformFactory = CipherTransformFactory;
exports.PDF17 = PDF17;
exports.PDF20 = PDF20;
exports.calculateMD5 = calculateMD5;
exports.calculateSHA256 = calculateSHA256;
exports.calculateSHA384 = calculateSHA384;
exports.calculateSHA512 = calculateSHA512;
}));

View File

@ -12,15 +12,59 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals warn, Dict, isDict, shadow, isArray, Util, StreamsSequenceStream,
isStream, NullStream, ObjectLoader, PartialEvaluator, Promise,
OperatorList, Annotation, error, assert, XRef, isArrayBuffer, Stream,
isString, isName, info, Linearization, MissingDataException, Lexer,
Catalog, stringToPDFString, stringToBytes, calculateMD5,
AnnotationFactory */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/document', ['exports', 'pdfjs/shared/util',
'pdfjs/core/primitives', 'pdfjs/core/stream', 'pdfjs/core/obj',
'pdfjs/core/parser', 'pdfjs/core/crypto', 'pdfjs/core/evaluator',
'pdfjs/core/annotation'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./primitives.js'),
require('./stream.js'), require('./obj.js'), require('./parser.js'),
require('./crypto.js'), require('./evaluator.js'),
require('./annotation.js'));
} else {
factory((root.pdfjsCoreDocument = {}), root.pdfjsSharedUtil,
root.pdfjsCorePrimitives, root.pdfjsCoreStream,
root.pdfjsCoreObj, root.pdfjsCoreParser, root.pdfjsCoreCrypto,
root.pdfjsCoreEvaluator, root.pdfjsCoreAnnotation);
}
}(this, function (exports, sharedUtil, corePrimitives, coreStream, coreObj,
coreParser, coreCrypto, coreEvaluator, coreAnnotation) {
var MissingDataException = sharedUtil.MissingDataException;
var Util = sharedUtil.Util;
var assert = sharedUtil.assert;
var error = sharedUtil.error;
var info = sharedUtil.info;
var isArray = sharedUtil.isArray;
var isArrayBuffer = sharedUtil.isArrayBuffer;
var isString = sharedUtil.isString;
var shadow = sharedUtil.shadow;
var stringToBytes = sharedUtil.stringToBytes;
var stringToPDFString = sharedUtil.stringToPDFString;
var warn = sharedUtil.warn;
var Dict = corePrimitives.Dict;
var isDict = corePrimitives.isDict;
var isName = corePrimitives.isName;
var isStream = corePrimitives.isStream;
var NullStream = coreStream.NullStream;
var Stream = coreStream.Stream;
var StreamsSequenceStream = coreStream.StreamsSequenceStream;
var Catalog = coreObj.Catalog;
var ObjectLoader = coreObj.ObjectLoader;
var XRef = coreObj.XRef;
var Lexer = coreParser.Lexer;
var Linearization = coreParser.Linearization;
var calculateMD5 = coreCrypto.calculateMD5;
var OperatorList = coreEvaluator.OperatorList;
var PartialEvaluator = coreEvaluator.PartialEvaluator;
var Annotation = coreAnnotation.Annotation;
var AnnotationFactory = coreAnnotation.AnnotationFactory;
var Page = (function PageClosure() {
var LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
@ -478,7 +522,14 @@ var PDFDocument = (function PDFDocumentClosure() {
},
setup: function PDFDocument_setup(recoveryMode) {
this.xref.parse(recoveryMode);
this.catalog = new Catalog(this.pdfManager, this.xref);
var self = this;
var pageFactory = {
createPage: function (pageIndex, dict, ref, fontCache) {
return new Page(self.pdfManager, self.xref, pageIndex, dict, ref,
fontCache);
}
};
this.catalog = new Catalog(this.pdfManager, this.xref, pageFactory);
},
get numPages() {
var linearization = this.linearization;
@ -551,3 +602,7 @@ var PDFDocument = (function PDFDocumentClosure() {
return PDFDocument;
})();
exports.Page = Page;
exports.PDFDocument = PDFDocument;
}));

View File

@ -12,19 +12,85 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals assert, CMapFactory, ColorSpace, DecodeStream, Dict, Encodings,
error, ErrorFont, Font, FONT_IDENTITY_MATRIX, fontCharsToUnicode,
FontFlags, ImageKind, info, isArray, isCmd, isDict, isEOF, isName,
isNum, isStream, isString, JpegStream, Lexer, Metrics, IdentityCMap,
MurmurHash3_64, Name, Parser, Pattern, PDFImage, PDFJS, serifFonts,
stdFontMap, symbolsFonts, getTilingPatternIR, warn, Util, Promise,
RefSetCache, isRef, TextRenderingMode, IdentityToUnicodeMap,
OPS, UNSUPPORTED_FEATURES, NormalizedUnicodes, IDENTITY_MATRIX,
reverseIfRtl, createPromiseCapability, ToUnicodeMap, getFontType,
isPDFFunction, PDFFunction */
/* globals PDFJS */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/evaluator', ['exports', 'pdfjs/shared/util',
'pdfjs/core/primitives', 'pdfjs/core/stream', 'pdfjs/core/parser',
'pdfjs/core/image', 'pdfjs/core/colorspace', 'pdfjs/core/murmurhash3',
'pdfjs/core/fonts', 'pdfjs/core/function', 'pdfjs/core/pattern',
'pdfjs/core/cmap', 'pdfjs/core/metrics', 'pdfjs/core/bidi'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./primitives.js'),
require('./stream.js'), require('./parser.js'), require('./image.js'),
require('./colorspace.js'), require('./murmurhash3.js'),
require('./fonts.js'), require('./function.js'), require('./pattern.js'),
require('./cmap.js'), require('./metrics.js'), require('./bidi.js'));
} else {
factory((root.pdfjsCoreEvaluator = {}), root.pdfjsSharedUtil,
root.pdfjsCorePrimitives, root.pdfjsCoreStream, root.pdfjsCoreParser,
root.pdfjsCoreImage, root.pdfjsCoreColorSpace, root.pdfjsCoreMurmurHash3,
root.pdfjsCoreFonts, root.pdfjsCoreFunction, root.pdfjsCorePattern,
root.pdfjsCoreCMap, root.pdfjsCoreMetrics, root.pdfjsCoreBidi);
}
}(this, function (exports, sharedUtil, corePrimitives, coreStream, coreParser,
coreImage, coreColorSpace, coreMurmurHash3, coreFonts,
coreFunction, corePattern, coreCMap, coreMetrics, coreBidi) {
var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX;
var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
var ImageKind = sharedUtil.ImageKind;
var OPS = sharedUtil.OPS;
var TextRenderingMode = sharedUtil.TextRenderingMode;
var Util = sharedUtil.Util;
var assert = sharedUtil.assert;
var createPromiseCapability = sharedUtil.createPromiseCapability;
var error = sharedUtil.error;
var info = sharedUtil.info;
var isArray = sharedUtil.isArray;
var isNum = sharedUtil.isNum;
var isString = sharedUtil.isString;
var warn = sharedUtil.warn;
var Dict = corePrimitives.Dict;
var Name = corePrimitives.Name;
var isCmd = corePrimitives.isCmd;
var isDict = corePrimitives.isDict;
var isName = corePrimitives.isName;
var isRef = corePrimitives.isRef;
var isStream = corePrimitives.isStream;
var DecodeStream = coreStream.DecodeStream;
var JpegStream = coreStream.JpegStream;
var Lexer = coreParser.Lexer;
var Parser = coreParser.Parser;
var isEOF = coreParser.isEOF;
var PDFImage = coreImage.PDFImage;
var ColorSpace = coreColorSpace.ColorSpace;
var MurmurHash3_64 = coreMurmurHash3.MurmurHash3_64;
var Encodings = coreFonts.Encodings;
var ErrorFont = coreFonts.ErrorFont;
var FontFlags = coreFonts.FontFlags;
var Font = coreFonts.Font;
var IdentityToUnicodeMap = coreFonts.IdentityToUnicodeMap;
var NormalizedUnicodes = coreFonts.NormalizedUnicodes;
var ToUnicodeMap = coreFonts.ToUnicodeMap;
var getFontType = coreFonts.getFontType;
var reverseIfRtl = coreFonts.reverseIfRtl;
var serifFonts = coreFonts.serifFonts;
var symbolsFonts = coreFonts.symbolsFonts;
var stdFontMap = coreFonts.stdFontMap;
var isPDFFunction = coreFunction.isPDFFunction;
var PDFFunction = coreFunction.PDFFunction;
var Pattern = corePattern.Pattern;
var getTilingPatternIR = corePattern.getTilingPatternIR;
var CMapFactory = coreCMap.CMapFactory;
var IdentityCMap = coreCMap.IdentityCMap;
var Metrics = coreMetrics.Metrics;
var bidi = coreBidi.bidi;
var PartialEvaluator = (function PartialEvaluatorClosure() {
function PartialEvaluator(pdfManager, xref, handler, pageIndex,
uniquePrefix, idCounters, fontCache) {
@ -2889,3 +2955,7 @@ var QueueOptimizer = (function QueueOptimizerClosure() {
};
return QueueOptimizer;
})();
exports.OperatorList = OperatorList;
exports.PartialEvaluator = PartialEvaluator;
}));

View File

@ -12,10 +12,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals error, bytesToString, Stream, GlyphsUnicode, CFFParser, Encodings,
Util */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/font_renderer', ['exports', 'pdfjs/shared/util',
'pdfjs/core/stream', 'pdfjs/core/glyphlist'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./stream.js'),
require('./glyphlist.js'));
} else {
factory((root.pdfjsCoreFontRenderer = {}), root.pdfjsSharedUtil,
root.pdfjsCoreStream, root.pdfjsCoreGlyphList);
}
}(this, function (exports, sharedUtil, coreStream, coreGlyphList) {
var Util = sharedUtil.Util;
var bytesToString = sharedUtil.bytesToString;
var error = sharedUtil.error;
var Stream = coreStream.Stream;
var GlyphsUnicode = coreGlyphList.GlyphsUnicode;
var coreFonts; // see _setCoreFonts below
var CFFParser; // = coreFonts.CFFParser;
var Encodings; // = coreFonts.Encodings;
var FontRendererFactory = (function FontRendererFactoryClosure() {
function getLong(data, offset) {
@ -706,3 +726,15 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
}
};
})();
// TODO refactor to remove cyclic dependency on fonts.js
function _setCoreFonts(coreFonts_) {
coreFonts = coreFonts_;
Encodings = coreFonts_.Encodings;
CFFParser = coreFonts_.CFFParser;
}
exports._setCoreFonts = _setCoreFonts;
exports.FontRendererFactory = FontRendererFactory;
}));

View File

@ -12,14 +12,57 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals FONT_IDENTITY_MATRIX, FontType, warn, GlyphsUnicode, error, string32,
readUint32, Stream, FontRendererFactory, shadow, stringToBytes,
bytesToString, info, assert, IdentityCMap, Name, CMapFactory, PDFJS,
isNum, Lexer, isArray, ISOAdobeCharset, ExpertCharset, isInt,
ExpertSubsetCharset, Util, DingbatsGlyphsUnicode */
/* globals PDFJS */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/fonts', ['exports', 'pdfjs/shared/util',
'pdfjs/core/primitives', 'pdfjs/core/stream', 'pdfjs/core/parser',
'pdfjs/core/cmap', 'pdfjs/core/glyphlist', 'pdfjs/core/charsets',
'pdfjs/core/font_renderer'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./primitives.js'),
require('./stream.js'), require('./parser.js'), require('./cmap.js'),
require('./glyphlist.js'), require('./charsets.js'),
require('./font_renderer.js'));
} else {
factory((root.pdfjsCoreFonts = {}), root.pdfjsSharedUtil,
root.pdfjsCorePrimitives, root.pdfjsCoreStream, root.pdfjsCoreParser,
root.pdfjsCoreCMap, root.pdfjsCoreGlyphList, root.pdfjsCoreCharsets,
root.pdfjsCoreFontRenderer);
}
}(this, function (exports, sharedUtil, corePrimitives, coreStream, coreParser,
coreCMap, coreGlyphList, coreCharsets, coreFontRenderer) {
var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
var FontType = sharedUtil.FontType;
var Util = sharedUtil.Util;
var assert = sharedUtil.assert;
var bytesToString = sharedUtil.bytesToString;
var error = sharedUtil.error;
var info = sharedUtil.info;
var isArray = sharedUtil.isArray;
var isInt = sharedUtil.isInt;
var isNum = sharedUtil.isNum;
var readUint32 = sharedUtil.readUint32;
var shadow = sharedUtil.shadow;
var stringToBytes = sharedUtil.stringToBytes;
var string32 = sharedUtil.string32;
var warn = sharedUtil.warn;
var Name = corePrimitives.Name;
var Stream = coreStream.Stream;
var Lexer = coreParser.Lexer;
var CMapFactory = coreCMap.CMapFactory;
var IdentityCMap = coreCMap.IdentityCMap;
var GlyphsUnicode = coreGlyphList.GlyphsUnicode;
var DingbatsGlyphsUnicode = coreGlyphList.DingbatsGlyphsUnicode;
var ISOAdobeCharset = coreCharsets.ISOAdobeCharset;
var ExpertCharset = coreCharsets.ExpertCharset;
var ExpertSubsetCharset = coreCharsets.ExpertSubsetCharset;
var FontRendererFactory = coreFontRenderer.FontRendererFactory;
// Unicode Private Use Area
var PRIVATE_USE_OFFSET_START = 0xE000;
var PRIVATE_USE_OFFSET_END = 0xF8FF;
@ -7354,9 +7397,13 @@ var CFFCompiler = (function CFFCompilerClosure() {
return CFFCompiler;
})();
function _enableSeacAnalysis(enabled) {
exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED = enabled;
}
// Workaround for seac on Windows.
(function checkSeacSupport() {
if (/Windows/.test(navigator.userAgent)) {
if (typeof navigator !== 'undefined' && /Windows/.test(navigator.userAgent)) {
SEAC_ANALYSIS_ENABLED = true;
}
})();
@ -7365,7 +7412,32 @@ var CFFCompiler = (function CFFCompilerClosure() {
// http://code.google.com/p/chromium/issues/detail?id=122465
// https://github.com/mozilla/pdf.js/issues/1689
(function checkChromeWindows() {
if (/Windows.*Chrome/.test(navigator.userAgent)) {
if (typeof navigator !== 'undefined' &&
/Windows.*Chrome/.test(navigator.userAgent)) {
SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = true;
}
})();
exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
exports.CFFCompiler = CFFCompiler;
exports.CFFIndex = CFFIndex;
exports.CFFParser = CFFParser;
exports.CFFStrings = CFFStrings;
exports.Encodings = Encodings;
exports.ErrorFont = ErrorFont;
exports.FontFlags = FontFlags;
exports.Font = Font;
exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
exports.NormalizedUnicodes = NormalizedUnicodes;
exports.ToUnicodeMap = ToUnicodeMap;
exports.Type1Parser = Type1Parser;
exports.getFontType = getFontType;
exports.reverseIfRtl = reverseIfRtl;
exports.serifFonts = serifFonts;
exports.symbolsFonts = symbolsFonts;
exports.stdFontMap = stdFontMap;
exports._enableSeacAnalysis = _enableSeacAnalysis;
// TODO refactor to remove cyclic dependency on font_renderer.js
coreFontRenderer._setCoreFonts(exports);
}));

View File

@ -12,11 +12,31 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PostScriptLexer, PostScriptParser, error, info, isArray, isBool,
isDict, isStream */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/function', ['exports', 'pdfjs/shared/util',
'pdfjs/core/primitives', 'pdfjs/core/ps_parser'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./primitives.js'),
require('./ps_parser.js'));
} else {
factory((root.pdfjsCoreFunction = {}), root.pdfjsSharedUtil,
root.pdfjsCorePrimitives, root.pdfjsCorePsParser);
}
}(this, function (exports, sharedUtil, corePrimitives, corePsParser) {
var error = sharedUtil.error;
var info = sharedUtil.info;
var isArray = sharedUtil.isArray;
var isBool = sharedUtil.isBool;
var isDict = corePrimitives.isDict;
var isStream = corePrimitives.isStream;
var PostScriptLexer = corePsParser.PostScriptLexer;
var PostScriptParser = corePsParser.PostScriptParser;
var PDFFunction = (function PDFFunctionClosure() {
var CONSTRUCT_SAMPLED = 0;
var CONSTRUCT_INTERPOLATED = 2;
@ -1131,3 +1151,9 @@ var PostScriptCompiler = (function PostScriptCompilerClosure() {
return PostScriptCompiler;
})();
exports.isPDFFunction = isPDFFunction;
exports.PDFFunction = PDFFunction;
exports.PostScriptEvaluator = PostScriptEvaluator;
exports.PostScriptCompiler = PostScriptCompiler;
}));

View File

@ -15,6 +15,16 @@
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/glyphlist', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsCoreGlyphList = {}));
}
}(this, function (exports) {
var GlyphsUnicode = {
A: 0x0041,
AE: 0x00C6,
@ -4427,3 +4437,7 @@ var DingbatsGlyphsUnicode = {
a96: 0x2775, // 0xF8E4
'.notdef': 0x0000
};
exports.GlyphsUnicode = GlyphsUnicode;
exports.DingbatsGlyphsUnicode = DingbatsGlyphsUnicode;
}));

View File

@ -12,11 +12,40 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals assert, ColorSpace, DecodeStream, error, info, isArray, ImageKind,
isStream, JpegStream, JpxImage, Name, Promise, Stream, warn */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/image', ['exports', 'pdfjs/shared/util',
'pdfjs/core/primitives', 'pdfjs/core/colorspace', 'pdfjs/core/stream',
'pdfjs/core/jpx'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./primitives.js'),
require('./colorspace.js'), require('./stream.js'),
require('./jpx.js'));
} else {
factory((root.pdfjsCoreImage = {}), root.pdfjsSharedUtil,
root.pdfjsCorePrimitives, root.pdfjsCoreColorSpace, root.pdfjsCoreStream,
root.pdfjsCoreJpx);
}
}(this, function (exports, sharedUtil, corePrimitives, coreColorSpace,
coreStream, coreJpx) {
var ImageKind = sharedUtil.ImageKind;
var assert = sharedUtil.assert;
var error = sharedUtil.error;
var info = sharedUtil.info;
var isArray = sharedUtil.isArray;
var warn = sharedUtil.warn;
var Name = corePrimitives.Name;
var isStream = corePrimitives.isStream;
var ColorSpace = coreColorSpace.ColorSpace;
var DecodeStream = coreStream.DecodeStream;
var Stream = coreStream.Stream;
var JpegStream = coreStream.JpegStream;
var JpxImage = coreJpx.JpxImage;
var PDFImage = (function PDFImageClosure() {
/**
* Decode the image in the main thread if it supported. Resovles the promise
@ -672,3 +701,9 @@ var PDFImage = (function PDFImageClosure() {
};
return PDFImage;
})();
exports.PDFImage = PDFImage;
// TODO refactor to remove dependency on colorspace.js
coreColorSpace._setCoreImage(exports);
}));

View File

@ -12,11 +12,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals ArithmeticDecoder, error, log2, readInt8, readUint16, readUint32,
shadow */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/jbig2', ['exports', 'pdfjs/shared/util',
'pdfjs/core/arithmetic_decoder'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'),
require('./arithmetic_decoder.js'));
} else {
factory((root.pdfjsCoreJbig2 = {}), root.pdfjsSharedUtil,
root.pdfjsCoreArithmeticDecoder);
}
}(this, function (exports, sharedUtil, coreArithmeticDecoder) {
var error = sharedUtil.error;
var log2 = sharedUtil.log2;
var readInt8 = sharedUtil.readInt8;
var readUint16 = sharedUtil.readUint16;
var readUint32 = sharedUtil.readUint32;
var shadow = sharedUtil.shadow;
var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
var Jbig2Image = (function Jbig2ImageClosure() {
// Utility data structures
function ContextCache() {}
@ -1084,3 +1103,6 @@ var Jbig2Image = (function Jbig2ImageClosure() {
return Jbig2Image;
})();
exports.Jbig2Image = Jbig2Image;
}));

View File

@ -14,6 +14,18 @@
* limitations under the License.
*/
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/jpg', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsCoreJpg = {}));
}
}(this, function (exports) {
/*
This code was forked from https://github.com/notmasteryet/jpgjs. The original
version was created by github user notmasteryet
@ -27,8 +39,6 @@ version was created by github user notmasteryet
(partners.adobe.com/public/developer/en/ps/sdk/5116.DCT_Filter.pdf)
*/
'use strict';
var JpegImage = (function jpegImage() {
var dctZigZag = new Uint8Array([
0,
@ -1033,3 +1043,6 @@ var JpegImage = (function jpegImage() {
return constructor;
})();
exports.JpegImage = JpegImage;
}));

View File

@ -12,11 +12,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals ArithmeticDecoder, globalScope, log2, readUint16, readUint32,
info, warn */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/jpx', ['exports', 'pdfjs/shared/util',
'pdfjs/core/arithmetic_decoder'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'),
require('./arithmetic_decoder.js'));
} else {
factory((root.pdfjsCoreJpx = {}), root.pdfjsSharedUtil,
root.pdfjsCoreArithmeticDecoder);
}
}(this, function (exports, sharedUtil, coreArithmeticDecoder) {
var info = sharedUtil.info;
var log2 = sharedUtil.log2;
var readUint16 = sharedUtil.readUint16;
var readUint32 = sharedUtil.readUint32;
var warn = sharedUtil.warn;
var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
var JpxImage = (function JpxImageClosure() {
// Table E.1
var SubbandsGainLog2 = {
@ -2211,3 +2229,6 @@ var JpxImage = (function JpxImageClosure() {
return JpxImage;
})();
exports.JpxImage = JpxImage;
}));

View File

@ -15,6 +15,16 @@
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/metrics', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsCoreMetrics = {}));
}
}(this, function (exports) {
// The Metrics object contains glyph widths (in glyph space units).
// As per PDF spec, for most fonts (Type 3 being an exception) a glyph
// space unit corresponds to 1/1000th of text space unit.
@ -2956,3 +2966,6 @@ var Metrics = {
'a191': 918
}
};
exports.Metrics = Metrics;
}));

View File

@ -17,10 +17,21 @@
* Based on https://code.google.com/p/smhasher/wiki/MurmurHash3.
* Hashes roughly 100 KB per millisecond on i7 3.4 GHz.
*/
/* globals Uint32ArrayView */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/murmurhash3', ['exports', 'pdfjs/shared/util'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'));
} else {
factory((root.pdfjsCoreMurmurHash3 = {}), root.pdfjsSharedUtil);
}
}(this, function (exports, sharedUtil) {
var Uint32ArrayView = sharedUtil.Uint32ArrayView;
var MurmurHash3_64 = (function MurmurHash3_64Closure (seed) {
// Workaround for missing math precison in JS.
var MASK_HIGH = 0xffff0000;
@ -162,3 +173,6 @@ var MurmurHash3_64 = (function MurmurHash3_64Closure (seed) {
return MurmurHash3_64;
})();
exports.MurmurHash3_64 = MurmurHash3_64;
}));

View File

@ -12,326 +12,56 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals assert, bytesToString, CipherTransformFactory, error, info,
InvalidPDFException, isArray, isCmd, isDict, isInt, isName, isRef,
isStream, Lexer, Page, Parser, Promise, shadow,
stringToPDFString, stringToUTF8String, warn, isString,
Promise, MissingDataException, XRefParseException, Stream,
ChunkedStream, createPromiseCapability */
'use strict';
var Name = (function NameClosure() {
function Name(name) {
this.name = name;
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/obj', ['exports', 'pdfjs/shared/util',
'pdfjs/core/primitives', 'pdfjs/core/crypto', 'pdfjs/core/parser',
'pdfjs/core/chunked_stream'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./primitives.js'),
require('./crypto.js'), require('./parser.js'),
require('./chunked_stream.js'));
} else {
factory((root.pdfjsCoreObj = {}), root.pdfjsSharedUtil,
root.pdfjsCorePrimitives, root.pdfjsCoreCrypto, root.pdfjsCoreParser,
root.pdfjsCoreChunkedStream);
}
}(this, function (exports, sharedUtil, corePrimitives, coreCrypto, coreParser,
coreChunkedStream) {
Name.prototype = {};
var nameCache = {};
Name.get = function Name_get(name) {
var nameValue = nameCache[name];
return (nameValue ? nameValue : (nameCache[name] = new Name(name)));
};
return Name;
})();
var Cmd = (function CmdClosure() {
function Cmd(cmd) {
this.cmd = cmd;
}
Cmd.prototype = {};
var cmdCache = {};
Cmd.get = function Cmd_get(cmd) {
var cmdValue = cmdCache[cmd];
return (cmdValue ? cmdValue : (cmdCache[cmd] = new Cmd(cmd)));
};
return Cmd;
})();
var Dict = (function DictClosure() {
var nonSerializable = function nonSerializableClosure() {
return nonSerializable; // creating closure on some variable
};
var GETALL_DICTIONARY_TYPES_WHITELIST = {
'Background': true,
'ExtGState': true,
'Halftone': true,
'Layout': true,
'Mask': true,
'Pagination': true,
'Printing': true
};
function isRecursionAllowedFor(dict) {
if (!isName(dict.Type)) {
return true;
}
var dictType = dict.Type.name;
return GETALL_DICTIONARY_TYPES_WHITELIST[dictType] === true;
}
// xref is optional
function Dict(xref) {
// Map should only be used internally, use functions below to access.
this.map = Object.create(null);
this.xref = xref;
this.objId = null;
this.__nonSerializable__ = nonSerializable; // disable cloning of the Dict
}
Dict.prototype = {
assignXref: function Dict_assignXref(newXref) {
this.xref = newXref;
},
// automatically dereferences Ref objects
get: function Dict_get(key1, key2, key3) {
var value;
var xref = this.xref;
if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map ||
typeof key2 === 'undefined') {
return xref ? xref.fetchIfRef(value) : value;
}
if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map ||
typeof key3 === 'undefined') {
return xref ? xref.fetchIfRef(value) : value;
}
value = this.map[key3] || null;
return xref ? xref.fetchIfRef(value) : value;
},
// Same as get(), but returns a promise and uses fetchIfRefAsync().
getAsync: function Dict_getAsync(key1, key2, key3) {
var value;
var xref = this.xref;
if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map ||
typeof key2 === 'undefined') {
if (xref) {
return xref.fetchIfRefAsync(value);
}
return Promise.resolve(value);
}
if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map ||
typeof key3 === 'undefined') {
if (xref) {
return xref.fetchIfRefAsync(value);
}
return Promise.resolve(value);
}
value = this.map[key3] || null;
if (xref) {
return xref.fetchIfRefAsync(value);
}
return Promise.resolve(value);
},
// Same as get(), but dereferences all elements if the result is an Array.
getArray: function Dict_getArray(key1, key2, key3) {
var value = this.get(key1, key2, key3);
var xref = this.xref;
if (!isArray(value) || !xref) {
return value;
}
value = value.slice(); // Ensure that we don't modify the Dict data.
for (var i = 0, ii = value.length; i < ii; i++) {
if (!isRef(value[i])) {
continue;
}
value[i] = xref.fetch(value[i]);
}
return value;
},
// no dereferencing
getRaw: function Dict_getRaw(key) {
return this.map[key];
},
// creates new map and dereferences all Refs
getAll: function Dict_getAll() {
var all = Object.create(null);
var queue = null;
var key, obj;
for (key in this.map) {
obj = this.get(key);
if (obj instanceof Dict) {
if (isRecursionAllowedFor(obj)) {
(queue || (queue = [])).push({target: all, key: key, obj: obj});
} else {
all[key] = this.getRaw(key);
}
} else {
all[key] = obj;
}
}
if (!queue) {
return all;
}
// trying to take cyclic references into the account
var processed = Object.create(null);
while (queue.length > 0) {
var item = queue.shift();
var itemObj = item.obj;
var objId = itemObj.objId;
if (objId && objId in processed) {
item.target[item.key] = processed[objId];
continue;
}
var dereferenced = Object.create(null);
for (key in itemObj.map) {
obj = itemObj.get(key);
if (obj instanceof Dict) {
if (isRecursionAllowedFor(obj)) {
queue.push({target: dereferenced, key: key, obj: obj});
} else {
dereferenced[key] = itemObj.getRaw(key);
}
} else {
dereferenced[key] = obj;
}
}
if (objId) {
processed[objId] = dereferenced;
}
item.target[item.key] = dereferenced;
}
return all;
},
getKeys: function Dict_getKeys() {
return Object.keys(this.map);
},
set: function Dict_set(key, value) {
this.map[key] = value;
},
has: function Dict_has(key) {
return key in this.map;
},
forEach: function Dict_forEach(callback) {
for (var key in this.map) {
callback(key, this.get(key));
}
}
};
Dict.empty = new Dict(null);
Dict.merge = function Dict_merge(xref, dictArray) {
var mergedDict = new Dict(xref);
for (var i = 0, ii = dictArray.length; i < ii; i++) {
var dict = dictArray[i];
if (!isDict(dict)) {
continue;
}
for (var keyName in dict.map) {
if (mergedDict.map[keyName]) {
continue;
}
mergedDict.map[keyName] = dict.map[keyName];
}
}
return mergedDict;
};
return Dict;
})();
var Ref = (function RefClosure() {
function Ref(num, gen) {
this.num = num;
this.gen = gen;
}
Ref.prototype = {
toString: function Ref_toString() {
// This function is hot, so we make the string as compact as possible.
// |this.gen| is almost always zero, so we treat that case specially.
var str = this.num + 'R';
if (this.gen !== 0) {
str += this.gen;
}
return str;
}
};
return Ref;
})();
// The reference is identified by number and generation.
// This structure stores only one instance of the reference.
var RefSet = (function RefSetClosure() {
function RefSet() {
this.dict = {};
}
RefSet.prototype = {
has: function RefSet_has(ref) {
return ref.toString() in this.dict;
},
put: function RefSet_put(ref) {
this.dict[ref.toString()] = true;
},
remove: function RefSet_remove(ref) {
delete this.dict[ref.toString()];
}
};
return RefSet;
})();
var RefSetCache = (function RefSetCacheClosure() {
function RefSetCache() {
this.dict = Object.create(null);
}
RefSetCache.prototype = {
get: function RefSetCache_get(ref) {
return this.dict[ref.toString()];
},
has: function RefSetCache_has(ref) {
return ref.toString() in this.dict;
},
put: function RefSetCache_put(ref, obj) {
this.dict[ref.toString()] = obj;
},
putAlias: function RefSetCache_putAlias(ref, aliasRef) {
this.dict[ref.toString()] = this.get(aliasRef);
},
forEach: function RefSetCache_forEach(fn, thisArg) {
for (var i in this.dict) {
fn.call(thisArg, this.dict[i]);
}
},
clear: function RefSetCache_clear() {
this.dict = Object.create(null);
}
};
return RefSetCache;
})();
var InvalidPDFException = sharedUtil.InvalidPDFException;
var MissingDataException = sharedUtil.MissingDataException;
var XRefParseException = sharedUtil.XRefParseException;
var assert = sharedUtil.assert;
var bytesToString = sharedUtil.bytesToString;
var createPromiseCapability = sharedUtil.createPromiseCapability;
var error = sharedUtil.error;
var info = sharedUtil.info;
var isArray = sharedUtil.isArray;
var isInt = sharedUtil.isInt;
var isString = sharedUtil.isString;
var shadow = sharedUtil.shadow;
var stringToPDFString = sharedUtil.stringToPDFString;
var stringToUTF8String = sharedUtil.stringToUTF8String;
var warn = sharedUtil.warn;
var Ref = corePrimitives.Ref;
var RefSet = corePrimitives.RefSet;
var RefSetCache = corePrimitives.RefSetCache;
var isName = corePrimitives.isName;
var isCmd = corePrimitives.isCmd;
var isDict = corePrimitives.isDict;
var isRef = corePrimitives.isRef;
var isStream = corePrimitives.isStream;
var CipherTransformFactory = coreCrypto.CipherTransformFactory;
var Lexer = coreParser.Lexer;
var Parser = coreParser.Parser;
var ChunkedStream = coreChunkedStream.ChunkedStream;
var Catalog = (function CatalogClosure() {
function Catalog(pdfManager, xref) {
function Catalog(pdfManager, xref, pageFactory) {
this.pdfManager = pdfManager;
this.xref = xref;
this.catDict = xref.getCatalogObj();
@ -339,6 +69,8 @@ var Catalog = (function CatalogClosure() {
assert(isDict(this.catDict),
'catalog object is not a dictionary');
// TODO refactor to move getPage() to the PDFDocument.
this.pageFactory = pageFactory;
this.pagePromises = [];
}
@ -617,8 +349,8 @@ var Catalog = (function CatalogClosure() {
function (a) {
var dict = a[0];
var ref = a[1];
return new Page(this.pdfManager, this.xref, pageIndex, dict, ref,
this.fontCache);
return this.pageFactory.createPage(pageIndex, dict, ref,
this.fontCache);
}.bind(this)
);
}
@ -1749,3 +1481,8 @@ var ObjectLoader = (function() {
return ObjectLoader;
})();
exports.Catalog = Catalog;
exports.ObjectLoader = ObjectLoader;
exports.XRef = XRef;
}));

View File

@ -12,14 +12,51 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals Ascii85Stream, AsciiHexStream, CCITTFaxStream, Cmd, Dict, error,
FlateStream, isArray, isCmd, isDict, isInt, isName, isNum, isRef,
isString, Jbig2Stream, JpegStream, JpxStream, LZWStream, Name,
NullStream, PredictorStream, Ref, RunLengthStream, warn, info,
StreamType, MissingDataException, assert */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/parser', ['exports', 'pdfjs/shared/util',
'pdfjs/core/primitives', 'pdfjs/core/stream'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./primitives.js'),
require('./stream.js'));
} else {
factory((root.pdfjsCoreParser = {}), root.pdfjsSharedUtil,
root.pdfjsCorePrimitives, root.pdfjsCoreStream);
}
}(this, function (exports, sharedUtil, corePrimitives, coreStream) {
var MissingDataException = sharedUtil.MissingDataException;
var StreamType = sharedUtil.StreamType;
var assert = sharedUtil.assert;
var error = sharedUtil.error;
var info = sharedUtil.info;
var isArray = sharedUtil.isArray;
var isInt = sharedUtil.isInt;
var isNum = sharedUtil.isNum;
var isString = sharedUtil.isString;
var warn = sharedUtil.warn;
var Cmd = corePrimitives.Cmd;
var Dict = corePrimitives.Dict;
var Name = corePrimitives.Name;
var Ref = corePrimitives.Ref;
var isCmd = corePrimitives.isCmd;
var isDict = corePrimitives.isDict;
var isName = corePrimitives.isName;
var Ascii85Stream = coreStream.Ascii85Stream;
var AsciiHexStream = coreStream.AsciiHexStream;
var CCITTFaxStream = coreStream.CCITTFaxStream;
var FlateStream = coreStream.FlateStream;
var Jbig2Stream = coreStream.Jbig2Stream;
var JpegStream = coreStream.JpegStream;
var JpxStream = coreStream.JpxStream;
var LZWStream = coreStream.LZWStream;
var NullStream = coreStream.NullStream;
var PredictorStream = coreStream.PredictorStream;
var RunLengthStream = coreStream.RunLengthStream;
var EOF = {};
function isEOF(v) {
@ -1074,3 +1111,13 @@ var Linearization = {
};
}
};
exports.EOF = EOF;
exports.Lexer = Lexer;
exports.Linearization = Linearization;
exports.Parser = Parser;
exports.isEOF = isEOF;
// TODO refactor to remove dependency on stream.js
coreStream._setCoreParser(exports);
}));

View File

@ -12,11 +12,36 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals ColorSpace, PDFFunction, Util, error, warn, info, isArray, isStream,
assert, isPDFFunction, UNSUPPORTED_FEATURES, MissingDataException */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/pattern', ['exports', 'pdfjs/shared/util',
'pdfjs/core/primitives', 'pdfjs/core/function',
'pdfjs/core/colorspace'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./primitives.js'),
require('./function.js'), require('./colorspace.js'));
} else {
factory((root.pdfjsCorePattern = {}), root.pdfjsSharedUtil,
root.pdfjsCorePrimitives, root.pdfjsCoreFunction,
root.pdfjsCoreColorSpace);
}
}(this, function (exports, sharedUtil, corePrimitives, coreFunction,
coreColorSpace) {
var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
var MissingDataException = sharedUtil.MissingDataException;
var Util = sharedUtil.Util;
var assert = sharedUtil.assert;
var error = sharedUtil.error;
var info = sharedUtil.info;
var warn = sharedUtil.warn;
var isStream = corePrimitives.isStream;
var PDFFunction = coreFunction.PDFFunction;
var ColorSpace = coreColorSpace.ColorSpace;
var ShadingType = {
FUNCTION_BASED: 1,
AXIAL: 2,
@ -805,3 +830,7 @@ function getTilingPatternIR(operatorList, dict, args) {
paintType, tilingType
];
}
exports.Pattern = Pattern;
exports.getTilingPatternIR = getTilingPatternIR;
}));

View File

@ -12,11 +12,33 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals NotImplementedException, MissingDataException, Promise, Stream,
PDFDocument, ChunkedStreamManager, createPromiseCapability, Util */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/pdf_manager', ['exports', 'pdfjs/shared/util',
'pdfjs/core/stream', 'pdfjs/core/chunked_stream', 'pdfjs/core/document'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./stream.js'),
require('./chunked_stream.js'), require('./document.js'));
} else {
factory((root.pdfjsCorePdfManager = {}), root.pdfjsSharedUtil,
root.pdfjsCoreStream, root.pdfjsCoreChunkedStream,
root.pdfjsCoreDocument);
}
}(this, function (exports, sharedUtil, coreStream, coreChunkedStream,
coreDocument) {
var NotImplementedException = sharedUtil.NotImplementedException;
var MissingDataException = sharedUtil.MissingDataException;
var createPromiseCapability = sharedUtil.createPromiseCapability;
var Util = sharedUtil.Util;
var Stream = coreStream.Stream;
var ChunkedStreamManager = coreChunkedStream.ChunkedStreamManager;
var PDFDocument = coreDocument.PDFDocument;
var BasePdfManager = (function BasePdfManagerClosure() {
function BasePdfManager() {
throw new Error('Cannot initialize BaseManagerManager');
@ -207,3 +229,7 @@ var NetworkPdfManager = (function NetworkPdfManagerClosure() {
return NetworkPdfManager;
})();
exports.LocalPdfManager = LocalPdfManager;
exports.NetworkPdfManager = NetworkPdfManager;
}));

378
src/core/primitives.js Normal file
View File

@ -0,0 +1,378 @@
/* Copyright 2012 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* uses XRef */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/primitives', ['exports', 'pdfjs/shared/util'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'));
} else {
factory((root.pdfjsCorePrimitives = {}), root.pdfjsSharedUtil);
}
}(this, function (exports, sharedUtil) {
var isArray = sharedUtil.isArray;
var Name = (function NameClosure() {
function Name(name) {
this.name = name;
}
Name.prototype = {};
var nameCache = {};
Name.get = function Name_get(name) {
var nameValue = nameCache[name];
return (nameValue ? nameValue : (nameCache[name] = new Name(name)));
};
return Name;
})();
var Cmd = (function CmdClosure() {
function Cmd(cmd) {
this.cmd = cmd;
}
Cmd.prototype = {};
var cmdCache = {};
Cmd.get = function Cmd_get(cmd) {
var cmdValue = cmdCache[cmd];
return (cmdValue ? cmdValue : (cmdCache[cmd] = new Cmd(cmd)));
};
return Cmd;
})();
var Dict = (function DictClosure() {
var nonSerializable = function nonSerializableClosure() {
return nonSerializable; // creating closure on some variable
};
var GETALL_DICTIONARY_TYPES_WHITELIST = {
'Background': true,
'ExtGState': true,
'Halftone': true,
'Layout': true,
'Mask': true,
'Pagination': true,
'Printing': true
};
function isRecursionAllowedFor(dict) {
if (!isName(dict.Type)) {
return true;
}
var dictType = dict.Type.name;
return GETALL_DICTIONARY_TYPES_WHITELIST[dictType] === true;
}
// xref is optional
function Dict(xref) {
// Map should only be used internally, use functions below to access.
this.map = Object.create(null);
this.xref = xref;
this.objId = null;
this.__nonSerializable__ = nonSerializable; // disable cloning of the Dict
}
Dict.prototype = {
assignXref: function Dict_assignXref(newXref) {
this.xref = newXref;
},
// automatically dereferences Ref objects
get: function Dict_get(key1, key2, key3) {
var value;
var xref = this.xref;
if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map ||
typeof key2 === 'undefined') {
return xref ? xref.fetchIfRef(value) : value;
}
if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map ||
typeof key3 === 'undefined') {
return xref ? xref.fetchIfRef(value) : value;
}
value = this.map[key3] || null;
return xref ? xref.fetchIfRef(value) : value;
},
// Same as get(), but returns a promise and uses fetchIfRefAsync().
getAsync: function Dict_getAsync(key1, key2, key3) {
var value;
var xref = this.xref;
if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map ||
typeof key2 === 'undefined') {
if (xref) {
return xref.fetchIfRefAsync(value);
}
return Promise.resolve(value);
}
if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map ||
typeof key3 === 'undefined') {
if (xref) {
return xref.fetchIfRefAsync(value);
}
return Promise.resolve(value);
}
value = this.map[key3] || null;
if (xref) {
return xref.fetchIfRefAsync(value);
}
return Promise.resolve(value);
},
// Same as get(), but dereferences all elements if the result is an Array.
getArray: function Dict_getArray(key1, key2, key3) {
var value = this.get(key1, key2, key3);
var xref = this.xref;
if (!isArray(value) || !xref) {
return value;
}
value = value.slice(); // Ensure that we don't modify the Dict data.
for (var i = 0, ii = value.length; i < ii; i++) {
if (!isRef(value[i])) {
continue;
}
value[i] = xref.fetch(value[i]);
}
return value;
},
// no dereferencing
getRaw: function Dict_getRaw(key) {
return this.map[key];
},
// creates new map and dereferences all Refs
getAll: function Dict_getAll() {
var all = Object.create(null);
var queue = null;
var key, obj;
for (key in this.map) {
obj = this.get(key);
if (obj instanceof Dict) {
if (isRecursionAllowedFor(obj)) {
(queue || (queue = [])).push({target: all, key: key, obj: obj});
} else {
all[key] = this.getRaw(key);
}
} else {
all[key] = obj;
}
}
if (!queue) {
return all;
}
// trying to take cyclic references into the account
var processed = Object.create(null);
while (queue.length > 0) {
var item = queue.shift();
var itemObj = item.obj;
var objId = itemObj.objId;
if (objId && objId in processed) {
item.target[item.key] = processed[objId];
continue;
}
var dereferenced = Object.create(null);
for (key in itemObj.map) {
obj = itemObj.get(key);
if (obj instanceof Dict) {
if (isRecursionAllowedFor(obj)) {
queue.push({target: dereferenced, key: key, obj: obj});
} else {
dereferenced[key] = itemObj.getRaw(key);
}
} else {
dereferenced[key] = obj;
}
}
if (objId) {
processed[objId] = dereferenced;
}
item.target[item.key] = dereferenced;
}
return all;
},
getKeys: function Dict_getKeys() {
return Object.keys(this.map);
},
set: function Dict_set(key, value) {
this.map[key] = value;
},
has: function Dict_has(key) {
return key in this.map;
},
forEach: function Dict_forEach(callback) {
for (var key in this.map) {
callback(key, this.get(key));
}
}
};
Dict.empty = new Dict(null);
Dict.merge = function Dict_merge(xref, dictArray) {
var mergedDict = new Dict(xref);
for (var i = 0, ii = dictArray.length; i < ii; i++) {
var dict = dictArray[i];
if (!isDict(dict)) {
continue;
}
for (var keyName in dict.map) {
if (mergedDict.map[keyName]) {
continue;
}
mergedDict.map[keyName] = dict.map[keyName];
}
}
return mergedDict;
};
return Dict;
})();
var Ref = (function RefClosure() {
function Ref(num, gen) {
this.num = num;
this.gen = gen;
}
Ref.prototype = {
toString: function Ref_toString() {
// This function is hot, so we make the string as compact as possible.
// |this.gen| is almost always zero, so we treat that case specially.
var str = this.num + 'R';
if (this.gen !== 0) {
str += this.gen;
}
return str;
}
};
return Ref;
})();
// The reference is identified by number and generation.
// This structure stores only one instance of the reference.
var RefSet = (function RefSetClosure() {
function RefSet() {
this.dict = {};
}
RefSet.prototype = {
has: function RefSet_has(ref) {
return ref.toString() in this.dict;
},
put: function RefSet_put(ref) {
this.dict[ref.toString()] = true;
},
remove: function RefSet_remove(ref) {
delete this.dict[ref.toString()];
}
};
return RefSet;
})();
var RefSetCache = (function RefSetCacheClosure() {
function RefSetCache() {
this.dict = Object.create(null);
}
RefSetCache.prototype = {
get: function RefSetCache_get(ref) {
return this.dict[ref.toString()];
},
has: function RefSetCache_has(ref) {
return ref.toString() in this.dict;
},
put: function RefSetCache_put(ref, obj) {
this.dict[ref.toString()] = obj;
},
putAlias: function RefSetCache_putAlias(ref, aliasRef) {
this.dict[ref.toString()] = this.get(aliasRef);
},
forEach: function RefSetCache_forEach(fn, thisArg) {
for (var i in this.dict) {
fn.call(thisArg, this.dict[i]);
}
},
clear: function RefSetCache_clear() {
this.dict = Object.create(null);
}
};
return RefSetCache;
})();
function isName(v) {
return v instanceof Name;
}
function isCmd(v, cmd) {
return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
}
function isDict(v, type) {
if (!(v instanceof Dict)) {
return false;
}
if (!type) {
return true;
}
var dictType = v.get('Type');
return isName(dictType) && dictType.name === type;
}
function isRef(v) {
return v instanceof Ref;
}
function isStream(v) {
return typeof v === 'object' && v !== null && v.getBytes !== undefined;
}
exports.Cmd = Cmd;
exports.Dict = Dict;
exports.Name = Name;
exports.Ref = Ref;
exports.RefSet = RefSet;
exports.RefSetCache = RefSetCache;
exports.isCmd = isCmd;
exports.isDict = isDict;
exports.isName = isName;
exports.isRef = isRef;
exports.isStream = isStream;
}));

View File

@ -12,10 +12,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals EOF, error, Lexer */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/ps_parser', ['exports', 'pdfjs/shared/util',
'pdfjs/core/parser'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./parser.js'));
} else {
factory((root.pdfjsCorePsParser = {}), root.pdfjsSharedUtil,
root.pdfjsCoreParser);
}
}(this, function (exports, sharedUtil, coreParser) {
var error = sharedUtil.error;
var EOF = coreParser.EOF;
var Lexer = coreParser.Lexer;
var PostScriptParser = (function PostScriptParserClosure() {
function PostScriptParser(lexer) {
this.lexer = lexer;
@ -218,3 +233,7 @@ var PostScriptLexer = (function PostScriptLexerClosure() {
};
return PostScriptLexer;
})();
exports.PostScriptLexer = PostScriptLexer;
exports.PostScriptParser = PostScriptParser;
}));

View File

@ -12,11 +12,44 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals bytesToString, ColorSpace, Dict, EOF, error, info, isArray,
Jbig2Image, JpegImage, JpxImage, Lexer, PDFJS, shadow, Util, warn */
/* globals PDFJS */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/stream', ['exports', 'pdfjs/shared/util',
'pdfjs/core/primitives', 'pdfjs/core/jbig2', 'pdfjs/core/jpg',
'pdfjs/core/jpx'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./primitives.js'),
require('./jbig2.js'), require('./jpg.js'), require('./jpx.js'));
} else {
factory((root.pdfjsCoreStream = {}), root.pdfjsSharedUtil,
root.pdfjsCorePrimitives, root.pdfjsCoreJbig2, root.pdfjsCoreJpg,
root.pdfjsCoreJpx);
}
}(this, function (exports, sharedUtil, corePrimitives, coreJbig2, coreJpg,
coreJpx) {
var Util = sharedUtil.Util;
var error = sharedUtil.error;
var info = sharedUtil.info;
var isArray = sharedUtil.isArray;
var shadow = sharedUtil.shadow;
var warn = sharedUtil.warn;
var Dict = corePrimitives.Dict;
var Jbig2Image = coreJbig2.Jbig2Image;
var JpegImage = coreJpg.JpegImage;
var JpxImage = coreJpx.JpxImage;
var coreParser; // see _setCoreParser below
var EOF; // = coreParser.EOF;
var Lexer; // = coreParser.Lexer;
var coreColorSpace; // see _setCoreColorSpace below
var ColorSpace; // = coreColorSpace.ColorSpace;
var Stream = (function StreamClosure() {
function Stream(arrayBuffer, start, length, dict) {
this.bytes = (arrayBuffer instanceof Uint8Array ?
@ -2464,3 +2497,36 @@ var NullStream = (function NullStreamClosure() {
return NullStream;
})();
// TODO refactor to remove dependency on parser.js
function _setCoreParser(coreParser_) {
coreParser = coreParser_;
EOF = coreParser_.EOF;
Lexer = coreParser_.Lexer;
}
exports._setCoreParser = _setCoreParser;
// TODO refactor to remove dependency on colorspace.js
function _setCoreColorSpace(coreColorSpace_) {
coreColorSpace = coreColorSpace_;
ColorSpace = coreColorSpace_.ColorSpace;
}
exports._setCoreColorSpace = _setCoreColorSpace;
exports.Ascii85Stream = Ascii85Stream;
exports.AsciiHexStream = AsciiHexStream;
exports.CCITTFaxStream = CCITTFaxStream;
exports.DecryptStream = DecryptStream;
exports.DecodeStream = DecodeStream;
exports.FlateStream = FlateStream;
exports.Jbig2Stream = Jbig2Stream;
exports.JpegStream = JpegStream;
exports.JpxStream = JpxStream;
exports.NullStream = NullStream;
exports.PredictorStream = PredictorStream;
exports.RunLengthStream = RunLengthStream;
exports.Stream = Stream;
exports.StreamsSequenceStream = StreamsSequenceStream;
exports.StringStream = StringStream;
exports.LZWStream = LZWStream;
}));

View File

@ -12,14 +12,46 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFJS, createPromiseCapability, LocalPdfManager, NetworkPdfManager,
NetworkManager, isInt, MissingPDFException, UNSUPPORTED_FEATURES,
UnexpectedResponseException, PasswordException, Promise, warn,
PasswordResponses, InvalidPDFException, UnknownErrorException,
XRefParseException, Ref, info, globalScope, error, MessageHandler */
/* globals NetworkManager */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/worker', ['exports', 'pdfjs/shared/util',
'pdfjs/core/primitives', 'pdfjs/core/pdf_manager', 'pdfjs/shared/global'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./primitives.js'),
require('./pdf_manager.js'), require('../shared/global.js'));
} else {
factory((root.pdfjsCoreWorker = {}), root.pdfjsSharedUtil,
root.pdfjsCorePrimitives, root.pdfjsCorePdfManager,
root.pdfjsSharedGlobal);
}
}(this, function (exports, sharedUtil, corePrimitives, corePdfManager,
sharedGlobal) {
var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
var InvalidPDFException = sharedUtil.InvalidPDFException;
var MessageHandler = sharedUtil.MessageHandler;
var MissingPDFException = sharedUtil.MissingPDFException;
var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
var PasswordException = sharedUtil.PasswordException;
var PasswordResponses = sharedUtil.PasswordResponses;
var UnknownErrorException = sharedUtil.UnknownErrorException;
var XRefParseException = sharedUtil.XRefParseException;
var createPromiseCapability = sharedUtil.createPromiseCapability;
var error = sharedUtil.error;
var info = sharedUtil.info;
var isInt = sharedUtil.isInt;
var warn = sharedUtil.warn;
var Ref = corePrimitives.Ref;
var LocalPdfManager = corePdfManager.LocalPdfManager;
var NetworkPdfManager = corePdfManager.NetworkPdfManager;
var globalScope = sharedGlobal.globalScope;
var PDFJS = sharedGlobal.PDFJS;
var WorkerTask = (function WorkerTaskClosure() {
function WorkerTask(name) {
this.name = name;
@ -616,11 +648,15 @@ var workerConsole = {
// Worker thread?
if (typeof window === 'undefined') {
if (typeof window === 'undefined' && typeof require === 'undefined') {
if (!('console' in globalScope)) {
globalScope.console = workerConsole;
}
var handler = new MessageHandler('worker', 'main', this);
WorkerMessageHandler.setup(handler, this);
var handler = new MessageHandler('worker', 'main', self);
WorkerMessageHandler.setup(handler, self);
}
exports.WorkerTask = WorkerTask;
exports.WorkerMessageHandler = WorkerMessageHandler;
}));

View File

@ -12,11 +12,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFJS, Util, AnnotationType, AnnotationBorderStyleType, warn,
CustomStyle, isExternalLinkTargetSet, LinkTargetStringMap */
/* globals PDFJS */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/display/annotation_layer', ['exports', 'pdfjs/shared/util',
'pdfjs/display/dom_utils'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./dom_utils.js'));
} else {
factory((root.pdfjsDisplayAnnotationLayer = {}), root.pdfjsSharedUtil,
root.pdfjsDisplayDOMUtils);
}
}(this, function (exports, sharedUtil, displayDOMUtils) {
var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType;
var AnnotationType = sharedUtil.AnnotationType;
var Util = sharedUtil.Util;
var isExternalLinkTargetSet = sharedUtil.Util;
var LinkTargetStringMap = sharedUtil.LinkTargetStringMap;
var warn = sharedUtil.warn;
var CustomStyle = displayDOMUtils.CustomStyle;
var ANNOT_MIN_SIZE = 10; // px
var AnnotationLayer = (function AnnotationLayerClosure() {
@ -349,5 +368,7 @@ var AnnotationLayer = (function AnnotationLayerClosure() {
update: update
};
})();
PDFJS.AnnotationLayer = AnnotationLayer;
exports.AnnotationLayer = AnnotationLayer;
}));

View File

@ -12,15 +12,50 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFJS, isArrayBuffer, error, combineUrl, createPromiseCapability,
StatTimer, globalScope, MessageHandler, info, FontLoader, Util, warn,
Promise, PasswordResponses, PasswordException, InvalidPDFException,
MissingPDFException, UnknownErrorException, FontFaceObject,
loadJpegStream, createScratchCanvas, CanvasGraphics, stringToBytes,
UnexpectedResponseException, deprecated */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/display/api', ['exports', 'pdfjs/shared/util',
'pdfjs/display/font_loader', 'pdfjs/display/canvas',
'pdfjs/shared/global', 'require'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./font_loader.js'),
require('./canvas.js'), require('../shared/global.js'));
} else {
factory((root.pdfjsDisplayAPI = {}), root.pdfjsSharedUtil,
root.pdfjsDisplayFontLoader, root.pdfjsDisplayCanvas,
root.pdfjsSharedGlobal);
}
}(this, function (exports, sharedUtil, displayFontLoader, displayCanvas,
sharedGlobal, amdRequire) {
var InvalidPDFException = sharedUtil.InvalidPDFException;
var MessageHandler = sharedUtil.MessageHandler;
var MissingPDFException = sharedUtil.MissingPDFException;
var PasswordResponses = sharedUtil.PasswordResponses;
var PasswordException = sharedUtil.PasswordException;
var StatTimer = sharedUtil.StatTimer;
var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
var UnknownErrorException = sharedUtil.UnknownErrorException;
var Util = sharedUtil.Util;
var createPromiseCapability = sharedUtil.createPromiseCapability;
var combineUrl = sharedUtil.combineUrl;
var error = sharedUtil.error;
var deprecated = sharedUtil.deprecated;
var info = sharedUtil.info;
var isArrayBuffer = sharedUtil.isArrayBuffer;
var loadJpegStream = sharedUtil.loadJpegStream;
var stringToBytes = sharedUtil.stringToBytes;
var warn = sharedUtil.warn;
var FontFaceObject = displayFontLoader.FontFaceObject;
var FontLoader = displayFontLoader.FontLoader;
var CanvasGraphics = displayCanvas.CanvasGraphics;
var createScratchCanvas = displayCanvas.createScratchCanvas;
var PDFJS = sharedGlobal.PDFJS;
var globalScope = sharedGlobal.globalScope;
var DEFAULT_RANGE_CHUNK_SIZE = 65536; // 2^16 = 65536
/**
@ -1134,7 +1169,16 @@ var PDFWorker = (function PDFWorkerClosure() {
// other files and resolves the promise. In production only the
// pdf.worker.js file is needed.
//#if !PRODUCTION
Util.loadScript(PDFJS.workerSrc);
if (typeof amdRequire === 'function') {
amdRequire(['pdfjs/core/worker'], function () {
PDFJS.fakeWorkerFilesLoadedCapability.resolve();
});
} else if (typeof require === 'function') {
require('../core/worker.js');
PDFJS.fakeWorkerFilesLoadedCapability.resolve();
} else {
Util.loadScript(PDFJS.workerSrc);
}
//#endif
//#if PRODUCTION && SINGLE_FILE
// PDFJS.fakeWorkerFilesLoadedCapability.resolve();
@ -2036,3 +2080,9 @@ PDFJS.UnsupportedManager = (function UnsupportedManagerClosure() {
}
};
})();
exports.getDocument = PDFJS.getDocument;
exports.PDFDataRangeTransport = PDFDataRangeTransport;
exports.PDFDocumentProxy = PDFDocumentProxy;
exports.PDFPageProxy = PDFPageProxy;
}));

View File

@ -12,13 +12,41 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals IDENTITY_MATRIX, FONT_IDENTITY_MATRIX, TextRenderingMode, ImageData,
ImageKind, PDFJS, Uint32ArrayView, error, WebGLUtils, OPS, warn,
shadow, isNum, Util, TilingPattern, getShadingPatternFromIR, isArray,
info, assert */
/* globals PDFJS, ImageData */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/display/canvas', ['exports', 'pdfjs/shared/util',
'pdfjs/display/pattern_helper', 'pdfjs/display/webgl'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'),
require('./pattern_helper.js'), require('./webgl.js'));
} else {
factory((root.pdfjsDisplayCanvas = {}), root.pdfjsSharedUtil,
root.pdfjsDisplayPatternHelper, root.pdfjsDisplayWebGL);
}
}(this, function (exports, sharedUtil, displayPatternHelper, displayWebGL) {
var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX;
var ImageKind = sharedUtil.ImageKind;
var OPS = sharedUtil.OPS;
var TextRenderingMode = sharedUtil.TextRenderingMode;
var Uint32ArrayView = sharedUtil.Uint32ArrayView;
var Util = sharedUtil.Util;
var assert = sharedUtil.assert;
var info = sharedUtil.info;
var isNum = sharedUtil.isNum;
var isArray = sharedUtil.isArray;
var error = sharedUtil.error;
var shadow = sharedUtil.shadow;
var warn = sharedUtil.warn;
var TilingPattern = displayPatternHelper.TilingPattern;
var getShadingPatternFromIR = displayPatternHelper.getShadingPatternFromIR;
var WebGLUtils = displayWebGL.WebGLUtils;
// <canvas> contexts store most of the state we need natively.
// However, PDF needs a bit more state, which we store here.
@ -1580,8 +1608,14 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
var color = IR[1];
var baseTransform = this.baseTransform ||
this.ctx.mozCurrentTransform.slice();
pattern = new TilingPattern(IR, color, this.ctx, this.objs,
this.commonObjs, baseTransform);
var self = this;
var canvasGraphicsFactory = {
createCanvasGraphics: function (ctx) {
return new CanvasGraphics(ctx, self.commonObjs, self.objs);
}
};
pattern = new TilingPattern(IR, color, this.ctx, canvasGraphicsFactory,
baseTransform);
} else {
pattern = getShadingPatternFromIR(IR);
}
@ -2181,3 +2215,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
return CanvasGraphics;
})();
exports.CanvasGraphics = CanvasGraphics;
exports.createScratchCanvas = createScratchCanvas;
}));

View File

@ -12,10 +12,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFJS */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/display/dom_utils', ['exports', 'pdfjs/shared/global'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/global.js'));
} else {
factory((root.pdfjsDisplayDOMUtils = {}), root.pdfjsSharedGlobal);
}
}(this, function (exports, sharedGlobal) {
var PDFJS = sharedGlobal.PDFJS;
/**
* Optimised CSS custom property getter/setter.
* @class
@ -71,3 +83,6 @@ var CustomStyle = (function CustomStyleClosure() {
})();
PDFJS.CustomStyle = CustomStyle;
exports.CustomStyle = CustomStyle;
}));

View File

@ -12,11 +12,33 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFJS, shadow, isWorker, assert, warn, bytesToString, string32,
globalScope, FontFace, Promise */
/* globals FontFace */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/display/font_loader', ['exports', 'pdfjs/shared/util',
'pdfjs/shared/global'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'),
require('../shared/global.js'));
} else {
factory((root.pdfjsDisplayFontLoader = {}), root.pdfjsSharedUtil,
root.pdfjsSharedGlobal);
}
}(this, function (exports, sharedUtil, sharedGlobal) {
var assert = sharedUtil.assert;
var bytesToString = sharedUtil.bytesToString;
var string32 = sharedUtil.string32;
var shadow = sharedUtil.shadow;
var warn = sharedUtil.warn;
var PDFJS = sharedGlobal.PDFJS;
var globalScope = sharedGlobal.globalScope;
var isWorker = sharedGlobal.isWorker;
function FontLoader(docId) {
this.docId = docId;
this.styleElement = null;
@ -430,3 +452,7 @@ var FontFaceObject = (function FontFaceObjectClosure() {
};
return FontFaceObject;
})();
exports.FontFaceObject = FontFaceObject;
exports.FontLoader = FontLoader;
}));

View File

@ -12,10 +12,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals Document, error, PDFJS */
/* globals PDFJS, Document */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/display/metadata', ['exports', 'pdfjs/shared/util'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'));
} else {
factory((root.pdfjsDisplayMetadata = {}), root.pdfjsSharedUtil);
}
}(this, function (exports, sharedUtil) {
var error = sharedUtil.error;
var Metadata = PDFJS.Metadata = (function MetadataClosure() {
function fixMetadata(meta) {
return meta.replace(/>\\376\\377([^<]+)/g, function(all, codes) {
@ -95,3 +107,6 @@ var Metadata = PDFJS.Metadata = (function MetadataClosure() {
return Metadata;
})();
exports.Metadata = Metadata;
}));

View File

@ -12,11 +12,27 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals CanvasGraphics, CachedCanvases, ColorSpace, Util, error, info,
isArray, makeCssRgb, WebGLUtils */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/display/pattern_helper', ['exports', 'pdfjs/shared/util',
'pdfjs/display/webgl'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./webgl.js'));
} else {
factory((root.pdfjsDisplayPatternHelper = {}), root.pdfjsSharedUtil,
root.pdfjsDisplayWebGL);
}
}(this, function (exports, sharedUtil, displayWebGL) {
var Util = sharedUtil.Util;
var info = sharedUtil.info;
var isArray = sharedUtil.isArray;
var error = sharedUtil.error;
var WebGLUtils = displayWebGL.WebGLUtils;
var ShadingIRs = {};
ShadingIRs.RadialAxial = {
@ -289,7 +305,7 @@ var TilingPattern = (function TilingPatternClosure() {
var MAX_PATTERN_SIZE = 3000; // 10in @ 300dpi shall be enough
function TilingPattern(IR, color, ctx, objs, commonObjs, baseTransform) {
function TilingPattern(IR, color, ctx, canvasGraphicsFactory, baseTransform) {
this.operatorList = IR[2];
this.matrix = IR[3] || [1, 0, 0, 1, 0, 0];
this.bbox = IR[4];
@ -298,8 +314,7 @@ var TilingPattern = (function TilingPatternClosure() {
this.paintType = IR[7];
this.tilingType = IR[8];
this.color = color;
this.objs = objs;
this.commonObjs = commonObjs;
this.canvasGraphicsFactory = canvasGraphicsFactory;
this.baseTransform = baseTransform;
this.type = 'Pattern';
this.ctx = ctx;
@ -314,8 +329,7 @@ var TilingPattern = (function TilingPatternClosure() {
var paintType = this.paintType;
var tilingType = this.tilingType;
var color = this.color;
var objs = this.objs;
var commonObjs = this.commonObjs;
var canvasGraphicsFactory = this.canvasGraphicsFactory;
info('TilingType: ' + tilingType);
@ -348,7 +362,7 @@ var TilingPattern = (function TilingPatternClosure() {
var tmpCanvas = owner.cachedCanvases.getCanvas('pattern',
width, height, true);
var tmpCtx = tmpCanvas.context;
var graphics = new CanvasGraphics(tmpCtx, commonObjs, objs);
var graphics = canvasGraphicsFactory.createCanvasGraphics(tmpCtx);
graphics.groupLevel = owner.groupLevel;
this.setFillAndStrokeStyleToContext(tmpCtx, paintType, color);
@ -423,3 +437,7 @@ var TilingPattern = (function TilingPatternClosure() {
return TilingPattern;
})();
exports.getShadingPatternFromIR = getShadingPatternFromIR;
exports.TilingPattern = TilingPattern;
}));

View File

@ -12,12 +12,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFJS, FONT_IDENTITY_MATRIX, IDENTITY_MATRIX, isArray,
isNum, OPS, Promise, Util, warn, ImageKind, PDFJS */
/* globals PDFJS */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/display/svg', ['exports', 'pdfjs/shared/util'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'));
} else {
factory((root.pdfjsDisplaySVG = {}), root.pdfjsSharedUtil);
}
}(this, function (exports, sharedUtil) {
//#if (GENERIC || SINGLE_FILE)
var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX;
var ImageKind = sharedUtil.ImageKind;
var OPS = sharedUtil.OPS;
var Util = sharedUtil.Util;
var isNum = sharedUtil.isNum;
var isArray = sharedUtil.isArray;
var warn = sharedUtil.warn;
var SVG_DEFAULTS = {
fontStyle: 'normal',
fontWeight: 'normal',
@ -1189,4 +1207,7 @@ var SVGGraphics = (function SVGGraphicsClosure() {
})();
PDFJS.SVGGraphics = SVGGraphics;
exports.SVGGraphics = SVGGraphics;
//#endif
}));

View File

@ -12,10 +12,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFJS, createPromiseCapability */
/* globals PDFJS */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/display/text_layer', ['exports', 'pdfjs/shared/util'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'));
} else {
factory((root.pdfjsDisplayTextLayer = {}), root.pdfjsSharedUtil);
}
}(this, function (exports, sharedUtil) {
var createPromiseCapability = sharedUtil.createPromiseCapability;
/**
* Text layer render parameters.
*
@ -235,3 +248,6 @@ var renderTextLayer = (function renderTextLayerClosure() {
})();
PDFJS.renderTextLayer = renderTextLayer;
exports.renderTextLayer = renderTextLayer;
}));

View File

@ -12,11 +12,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFJS, shadow */
/* globals PDFJS */
/* jshint -W043 */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/display/webgl', ['exports', 'pdfjs/shared/util'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'));
} else {
factory((root.pdfjsDisplayWebGL = {}), root.pdfjsSharedUtil);
}
}(this, function (exports, sharedUtil) {
var shadow = sharedUtil.shadow;
var WebGLUtils = (function WebGLUtilsClosure() {
function loadShader(gl, code, shaderType) {
var shader = gl.createShader(shaderType);
@ -433,3 +445,6 @@ var WebGLUtils = (function WebGLUtilsClosure() {
clear: cleanup
};
})();
exports.WebGLUtils = WebGLUtils;
}));

35
src/expose_to_global.js Normal file
View File

@ -0,0 +1,35 @@
/* Copyright 2015 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
NOTE: This file is created as a helper to expose all loaded internal exported
members to global scope.
*/
'use strict';
(function (root) {
for (var i in root) {
if (/^pdfjs(Shared|Core|Display)/.test(i)) {
var obj = root[i];
for (var j in obj) {
if (Object.getOwnPropertyDescriptor(root, j)) {
continue; // ignoring if already set
}
root[j] = obj[j];
}
}
}
})(window);

47
src/shared/global.js Normal file
View File

@ -0,0 +1,47 @@
/* Copyright 2015 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFJS, global */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/shared/global', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsSharedGlobal = {}));
}
}(this, function (exports) {
var globalScope = (typeof window !== 'undefined') ? window :
(typeof global !== 'undefined') ? global :
(typeof self !== 'undefined') ? self : this;
var isWorker = (typeof window === 'undefined');
// The global PDFJS object exposes the API
// In production, it will be declared outside a global wrapper
// In development, it will be declared here
if (!globalScope.PDFJS) {
globalScope.PDFJS = {};
}
globalScope.PDFJS.pdfBug = false;
exports.globalScope = globalScope;
exports.isWorker = isWorker;
exports.PDFJS = globalScope.PDFJS;
}));

View File

@ -12,14 +12,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals Cmd, ColorSpace, Dict, MozBlobBuilder, Name, PDFJS, Ref, URL,
Promise */
/* globals MozBlobBuilder, URL */
'use strict';
var globalScope = (typeof window === 'undefined') ? this : window;
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/shared/util', ['exports', 'pdfjs/shared/global'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./global.js'));
} else {
factory((root.pdfjsSharedUtil = {}), root.pdfjsSharedGlobal);
}
}(this, function (exports, sharedGlobal) {
var isWorker = (typeof window === 'undefined');
var PDFJS = sharedGlobal.PDFJS;
var globalScope = sharedGlobal.globalScope;
var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
@ -119,15 +127,6 @@ var FontType = {
MMTYPE1: 10
};
// The global PDFJS object exposes the API
// In production, it will be declared outside a global wrapper
// In development, it will be declared here
if (!globalScope.PDFJS) {
globalScope.PDFJS = {};
}
globalScope.PDFJS.pdfBug = false;
PDFJS.VERBOSITY_LEVELS = {
errors: 0,
warnings: 1,
@ -1046,41 +1045,14 @@ function isString(v) {
return typeof v === 'string';
}
function isName(v) {
return v instanceof Name;
}
function isCmd(v, cmd) {
return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
}
function isDict(v, type) {
if (!(v instanceof Dict)) {
return false;
}
if (!type) {
return true;
}
var dictType = v.get('Type');
return isName(dictType) && dictType.name === type;
}
function isArray(v) {
return v instanceof Array;
}
function isStream(v) {
return typeof v === 'object' && v !== null && v.getBytes !== undefined;
}
function isArrayBuffer(v) {
return typeof v === 'object' && v !== null && v.byteLength !== undefined;
}
function isRef(v) {
return v instanceof Ref;
}
/**
* Promise Capability object.
*
@ -1669,3 +1641,59 @@ function loadJpegStream(id, imageUrl, objs) {
});
img.src = imageUrl;
}
exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
exports.OPS = OPS;
exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
exports.AnnotationFlag = AnnotationFlag;
exports.AnnotationType = AnnotationType;
exports.FontType = FontType;
exports.ImageKind = ImageKind;
exports.InvalidPDFException = InvalidPDFException;
exports.LinkTarget = LinkTarget;
exports.LinkTargetStringMap = LinkTargetStringMap;
exports.MessageHandler = MessageHandler;
exports.MissingDataException = MissingDataException;
exports.MissingPDFException = MissingPDFException;
exports.NotImplementedException = NotImplementedException;
exports.PasswordException = PasswordException;
exports.PasswordResponses = PasswordResponses;
exports.StatTimer = StatTimer;
exports.StreamType = StreamType;
exports.TextRenderingMode = TextRenderingMode;
exports.Uint32ArrayView = Uint32ArrayView;
exports.UnexpectedResponseException = UnexpectedResponseException;
exports.UnknownErrorException = UnknownErrorException;
exports.Util = Util;
exports.XRefParseException = XRefParseException;
exports.assert = assert;
exports.bytesToString = bytesToString;
exports.combineUrl = combineUrl;
exports.createPromiseCapability = createPromiseCapability;
exports.deprecated = deprecated;
exports.error = error;
exports.info = info;
exports.isArray = isArray;
exports.isArrayBuffer = isArrayBuffer;
exports.isBool = isBool;
exports.isEmptyObj = isEmptyObj;
exports.isExternalLinkTargetSet = isExternalLinkTargetSet;
exports.isInt = isInt;
exports.isNum = isNum;
exports.isString = isString;
exports.isValidUrl = isValidUrl;
exports.loadJpegStream = loadJpegStream;
exports.log2 = log2;
exports.readInt8 = readInt8;
exports.readUint16 = readUint16;
exports.readUint32 = readUint32;
exports.shadow = shadow;
exports.string32 = string32;
exports.stringToBytes = stringToBytes;
exports.stringToPDFString = stringToPDFString;
exports.stringToUTF8String = stringToUTF8String;
exports.utf8StringToString = utf8StringToString;
exports.warn = warn;
}));

View File

@ -18,39 +18,41 @@
// List of shared files to include;
var sharedFiles = [
'shared/global.js',
'shared/util.js'
];
// List of other files to include;
var otherFiles = [
'core/network.js',
'core/chunked_stream.js',
'core/pdf_manager.js',
'core/core.js',
'core/obj.js',
'core/arithmetic_decoder.js',
'core/charsets.js',
'core/annotation.js',
'core/glyphlist.js',
'core/jpg.js',
'core/metrics.js',
'core/bidi.js',
'core/chunked_stream.js',
'core/jbig2.js',
'core/jpx.js',
'core/murmurhash3.js',
'core/primitives.js',
'core/stream.js',
'core/crypto.js',
'core/font_renderer.js',
'core/parser.js',
'core/cmap.js',
'core/obj.js',
'core/ps_parser.js',
'core/fonts.js',
'core/function.js',
'core/colorspace.js',
'core/crypto.js',
'core/image.js',
'core/pattern.js',
'core/evaluator.js',
'core/cmap.js',
'core/fonts.js',
'core/font_renderer.js',
'core/glyphlist.js',
'core/image.js',
'core/metrics.js',
'core/parser.js',
'core/ps_parser.js',
'core/stream.js',
'core/worker.js',
'core/arithmetic_decoder.js',
'core/jpg.js',
'core/jpx.js',
'core/jbig2.js',
'core/bidi.js',
'core/murmurhash3.js'
'core/annotation.js',
'core/document.js',
'core/pdf_manager.js',
'core/worker.js'
];
function loadInOrder(index, path, files) {

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFJS, combineUrl, StatTimer, Promise */
/* globals PDFJS, pdfjsSharedUtil */
'use strict';
@ -196,7 +196,8 @@ var Driver = (function DriverClosure() {
this._log('Loading file "' + task.file + '"\n');
var absoluteUrl = combineUrl(window.location.href, task.file);
var absoluteUrl = pdfjsSharedUtil.combineUrl(window.location.href,
task.file);
PDFJS.disableRange = task.disableRange;
PDFJS.disableAutoFetch = !task.enableAutoFetch;
@ -360,7 +361,7 @@ var Driver = (function DriverClosure() {
}
page.cleanup();
task.stats = page.stats;
page.stats = new StatTimer();
page.stats = new pdfjsSharedUtil.StatTimer();
self._snapshot(task, error);
});
initPromise.then(function () {

View File

@ -13,35 +13,46 @@
<!-- include source files here... -->
<script src="../../src/core/network.js"></script>
<script src="../../src/core/chunked_stream.js"></script>
<script src="../../src/core/pdf_manager.js"></script>
<script src="../../src/core/core.js"></script>
<script src="../../src/shared/util.js"></script>
<script src="../../src/display/api.js"></script>
<script src="../../src/display/canvas.js"></script>
<script src="../../src/display/webgl.js"></script>
<script src="../../src/core/obj.js"></script>
<script src="../../src/core/annotation.js"></script>
<script src="../../src/core/function.js"></script>
<script src="../../src/core/arithmetic_decoder.js"></script>
<script src="../../src/core/charsets.js"></script>
<script src="../../src/core/colorspace.js"></script>
<script src="../../src/core/glyphlist.js"></script>
<script src="../../src/core/jpg.js"></script>
<script src="../../src/core/metrics.js"></script>
<script src="../../src/shared/global.js"></script>
<script src="../../src/core/bidi.js"></script>
<script src="../../src/display/dom_utils.js"></script>
<script src="../../src/shared/util.js"></script>
<script src="../../src/core/chunked_stream.js"></script>
<script src="../../src/core/jbig2.js"></script>
<script src="../../src/core/jpx.js"></script>
<script src="../../src/core/murmurhash3.js"></script>
<script src="../../src/core/primitives.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/core/stream.js"></script>
<script src="../../src/display/pattern_helper.js"></script>
<script src="../../src/core/crypto.js"></script>
<script src="../../src/core/font_renderer.js"></script>
<script src="../../src/core/parser.js"></script>
<script src="../../src/display/canvas.js"></script>
<script src="../../src/core/cmap.js"></script>
<script src="../../src/core/obj.js"></script>
<script src="../../src/core/ps_parser.js"></script>
<script src="../../src/display/api.js"></script>
<script src="../../src/core/fonts.js"></script>
<script src="../../src/core/function.js"></script>
<script src="../../src/core/colorspace.js"></script>
<script src="../../src/core/image.js"></script>
<script src="../../src/core/pattern.js"></script>
<script src="../../src/core/evaluator.js"></script>
<script src="../../src/core/cmap.js"></script>
<script src="../../src/core/fonts.js"></script>
<script src="../../src/core/glyphlist.js"></script>
<script src="../../src/core/image.js"></script>
<script src="../../src/core/metrics.js"></script>
<script src="../../src/core/parser.js"></script>
<script src="../../src/core/ps_parser.js"></script>
<script src="../../src/display/pattern_helper.js"></script>
<script src="../../src/display/annotation_layer.js"></script>
<script src="../../src/display/text_layer.js"></script>
<script src="../../src/core/stream.js"></script>
<script src="../../src/core/annotation.js"></script>
<script src="../../src/core/document.js"></script>
<script src="../../src/core/pdf_manager.js"></script>
<script src="../../src/core/worker.js"></script>
<script src="../../src/display/metadata.js"></script>
<script src="../../src/core/jpg.js"></script>
<script src="../../src/expose_to_global.js"></script>
<script>PDFJS.workerSrc = '../../src/worker_loader.js';</script>
<!-- include spec files here... -->

View File

@ -18,16 +18,17 @@ limitations under the License.
<head>
<title>PDF.js test slave</title>
<meta charset="utf-8">
<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/api.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/canvas.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/font_loader.js"></script>
<script src="../src/display/dom_utils.js"></script>
<script src="../src/display/annotation_layer.js"></script>
<script src="../src/display/text_layer.js"></script>
<script src="../src/display/canvas.js"></script>
<script src="../src/display/api.js"></script>
<script src="driver.js"></script>
</head>
<body>

View File

@ -109,7 +109,7 @@ describe('font', function() {
it('parses a CharString endchar with 4 args w/seac enabled', function() {
var seacAnalysisState = SEAC_ANALYSIS_ENABLED;
try {
SEAC_ANALYSIS_ENABLED = true;
window.pdfjsCoreFonts._enableSeacAnalysis(true);
var bytes = new Uint8Array([0, 1, // count
1, // offsetSize
0, // offset[0]
@ -125,14 +125,14 @@ describe('font', function() {
expect(result.seacs[0][2]).toEqual(65);
expect(result.seacs[0][3]).toEqual(194);
} finally {
SEAC_ANALYSIS_ENABLED = seacAnalysisState;
window.pdfjsCoreFonts._enableSeacAnalysis(seacAnalysisState);
}
});
it('parses a CharString endchar with 4 args w/seac disabled', function() {
var seacAnalysisState = SEAC_ANALYSIS_ENABLED;
try {
SEAC_ANALYSIS_ENABLED = false;
window.pdfjsCoreFonts._enableSeacAnalysis(false);
var bytes = new Uint8Array([0, 1, // count
1, // offsetSize
0, // offset[0]
@ -143,7 +143,7 @@ describe('font', function() {
expect(result.charStrings.get(0).length).toEqual(9);
expect(result.seacs.length).toEqual(0);
} finally {
SEAC_ANALYSIS_ENABLED = seacAnalysisState;
window.pdfjsCoreFonts._enableSeacAnalysis(seacAnalysisState);
}
});

View File

@ -3,7 +3,7 @@
'use strict';
describe('obj', function() {
describe('primitives', function() {
describe('Name', function() {
it('should retain the given name', function() {

View File

@ -12,42 +12,51 @@
<!-- include source files here... -->
<script src="../../src/core/network.js"></script>
<script src="../../src/core/chunked_stream.js"></script>
<script src="../../src/core/pdf_manager.js"></script>
<script src="../../src/core/core.js"></script>
<script src="../../src/shared/util.js"></script>
<script src="../../src/display/api.js"></script>
<script src="../../src/display/canvas.js"></script>
<script src="../../src/display/webgl.js"></script>
<script src="../../src/core/obj.js"></script>
<script src="../../src/core/annotation.js"></script>
<script src="../../src/core/function.js"></script>
<script src="../../src/core/arithmetic_decoder.js"></script>
<script src="../../src/core/charsets.js"></script>
<script src="../../src/core/colorspace.js"></script>
<script src="../../src/core/glyphlist.js"></script>
<script src="../../src/core/jpg.js"></script>
<script src="../../src/core/metrics.js"></script>
<script src="../../src/shared/global.js"></script>
<script src="../../src/core/bidi.js"></script>
<script src="../../src/display/dom_utils.js"></script>
<script src="../../src/shared/util.js"></script>
<script src="../../src/core/chunked_stream.js"></script>
<script src="../../src/core/jbig2.js"></script>
<script src="../../src/core/jpx.js"></script>
<script src="../../src/core/murmurhash3.js"></script>
<script src="../../src/core/primitives.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/core/stream.js"></script>
<script src="../../src/display/pattern_helper.js"></script>
<script src="../../src/core/crypto.js"></script>
<script src="../../src/core/font_renderer.js"></script>
<script src="../../src/core/parser.js"></script>
<script src="../../src/display/canvas.js"></script>
<script src="../../src/core/cmap.js"></script>
<script src="../../src/core/obj.js"></script>
<script src="../../src/core/ps_parser.js"></script>
<script src="../../src/display/api.js"></script>
<script src="../../src/core/fonts.js"></script>
<script src="../../src/core/function.js"></script>
<script src="../../src/core/colorspace.js"></script>
<script src="../../src/core/image.js"></script>
<script src="../../src/core/pattern.js"></script>
<script src="../../src/core/evaluator.js"></script>
<script src="../../src/core/cmap.js"></script>
<script src="../../src/core/fonts.js"></script>
<script src="../../src/core/glyphlist.js"></script>
<script src="../../src/core/image.js"></script>
<script src="../../src/core/metrics.js"></script>
<script src="../../src/core/parser.js"></script>
<script src="../../src/core/ps_parser.js"></script>
<script src="../../src/display/pattern_helper.js"></script>
<script src="../../src/display/font_loader.js"></script>
<script src="../../src/display/dom_utils.js"></script>
<script src="../../src/display/annotation_layer.js"></script>
<script src="../../src/display/text_layer.js"></script>
<script src="../../src/core/stream.js"></script>
<script src="../../src/core/annotation.js"></script>
<script src="../../src/core/document.js"></script>
<script src="../../src/core/pdf_manager.js"></script>
<script src="../../src/core/worker.js"></script>
<script src="../../src/display/metadata.js"></script>
<script src="../../src/core/jpg.js"></script>
<script src="../../src/expose_to_global.js"></script>
<script src="../../web/ui_utils.js"></script>
<script>PDFJS.workerSrc = '../../src/worker_loader.js';</script>
<!-- include spec files here... -->
<script src="obj_spec.js"></script>
<script src="primitives_spec.js"></script>
<script src="font_spec.js"></script>
<script src="function_spec.js"></script>
<script src="crypto_spec.js"></script>

View File

@ -53,16 +53,17 @@ 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/api.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/canvas.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/font_loader.js"></script>
<script src="../src/display/dom_utils.js"></script>
<script src="../src/display/annotation_layer.js"></script>
<script src="../src/display/text_layer.js"></script>
<script src="../src/display/canvas.js"></script>
<script src="../src/display/api.js"></script>
<script>PDFJS.workerSrc = '../src/worker_loader.js';</script>
<!--#endif-->