Browse Source

Merge pull request #8284 from Snuffleupagus/es6-modules-src

Convert the files in the `/src/core` folder to ES6 modules
Jonas Jenwald 8 years ago committed by GitHub
parent
commit
e51718711b
  1. 12
      gulpfile.js
  2. 60
      src/core/annotation.js
  3. 17
      src/core/arithmetic_decoder.js
  4. 80
      src/core/bidi.js
  5. 58
      src/core/cff_parser.js
  6. 21
      src/core/charsets.js
  7. 31
      src/core/chunked_stream.js
  8. 46
      src/core/cmap.js
  9. 34
      src/core/colorspace.js
  10. 57
      src/core/crypto.js
  11. 71
      src/core/document.js
  12. 47
      src/core/encodings.js
  13. 135
      src/core/evaluator.js
  14. 35
      src/core/font_renderer.js
  15. 117
      src/core/fonts.js
  16. 37
      src/core/function.js
  17. 14
      src/core/glyphlist.js
  18. 41
      src/core/image.js
  19. 31
      src/core/jbig2.js
  20. 20
      src/core/jpg.js
  21. 31
      src/core/jpx.js
  22. 18
      src/core/metrics.js
  23. 17
      src/core/murmurhash3.js
  24. 88
      src/core/network.js
  25. 77
      src/core/obj.js
  26. 65
      src/core/parser.js
  27. 41
      src/core/pattern.js
  28. 42
      src/core/pdf_manager.js
  29. 45
      src/core/primitives.js
  30. 26
      src/core/ps_parser.js
  31. 70
      src/core/standard_fonts.js
  32. 74
      src/core/stream.js
  33. 27
      src/core/type1_parser.js
  34. 66
      src/core/unicode.js
  35. 54
      src/core/worker.js
  36. 1
      src/main_loader.js
  37. 1
      src/pdf.js
  38. 8
      test/driver.js
  39. 12
      test/test_slave.html
  40. 2
      test/unit/jasmine-boot.js

12
gulpfile.js

@ -1055,22 +1055,22 @@ gulp.task('publish', ['generic'], function (done) { @@ -1055,22 +1055,22 @@ gulp.task('publish', ['generic'], function (done) {
});
});
gulp.task('test', function () {
gulp.task('test', ['generic'], function () {
return streamqueue({ objectMode: true },
createTestSource('unit'), createTestSource('browser'));
});
gulp.task('bottest', function () {
gulp.task('bottest', ['generic'], function () {
return streamqueue({ objectMode: true },
createTestSource('unit'), createTestSource('font'),
createTestSource('browser (no reftest)'));
});
gulp.task('browsertest', function () {
gulp.task('browsertest', ['generic'], function () {
return createTestSource('browser');
});
gulp.task('unittest', function () {
gulp.task('unittest', ['generic'], function () {
return createTestSource('unit');
});
@ -1078,11 +1078,11 @@ gulp.task('fonttest', function () { @@ -1078,11 +1078,11 @@ gulp.task('fonttest', function () {
return createTestSource('font');
});
gulp.task('makeref', function (done) {
gulp.task('makeref', ['generic'], function (done) {
makeRef(done);
});
gulp.task('botmakeref', function (done) {
gulp.task('botmakeref', ['generic'], function (done) {
makeRef(done, true);
});

60
src/core/annotation.js

@ -13,47 +13,16 @@ @@ -13,47 +13,16 @@
* limitations under the License.
*/
'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 AnnotationFieldFlag = sharedUtil.AnnotationFieldFlag;
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 stringToBytes = sharedUtil.stringToBytes;
var stringToPDFString = sharedUtil.stringToPDFString;
var warn = sharedUtil.warn;
var Dict = corePrimitives.Dict;
var isDict = corePrimitives.isDict;
var isName = corePrimitives.isName;
var isRef = corePrimitives.isRef;
var isStream = corePrimitives.isStream;
var Stream = coreStream.Stream;
var ColorSpace = coreColorSpace.ColorSpace;
var Catalog = coreObj.Catalog;
var ObjectLoader = coreObj.ObjectLoader;
var FileSpec = coreObj.FileSpec;
var OperatorList = coreEvaluator.OperatorList;
import {
AnnotationBorderStyleType, AnnotationFieldFlag, AnnotationFlag,
AnnotationType, isArray, isInt, OPS, stringToBytes, stringToPDFString, Util,
warn
} from '../shared/util';
import { Catalog, FileSpec, ObjectLoader } from './obj';
import { Dict, isDict, isName, isRef, isStream } from './primitives';
import { ColorSpace } from './colorspace';
import { OperatorList } from './evaluator';
import { Stream } from './stream';
/**
* @class
@ -1074,7 +1043,8 @@ var FileAttachmentAnnotation = (function FileAttachmentAnnotationClosure() { @@ -1074,7 +1043,8 @@ var FileAttachmentAnnotation = (function FileAttachmentAnnotationClosure() {
return FileAttachmentAnnotation;
})();
exports.Annotation = Annotation;
exports.AnnotationBorderStyle = AnnotationBorderStyle;
exports.AnnotationFactory = AnnotationFactory;
}));
export {
Annotation,
AnnotationBorderStyle,
AnnotationFactory,
};

17
src/core/arithmetic_decoder.js

@ -13,18 +13,6 @@ @@ -13,18 +13,6 @@
* limitations under the License.
*/
'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
@ -192,5 +180,6 @@ var ArithmeticDecoder = (function ArithmeticDecoderClosure() { @@ -192,5 +180,6 @@ var ArithmeticDecoder = (function ArithmeticDecoderClosure() {
return ArithmeticDecoder;
})();
exports.ArithmeticDecoder = ArithmeticDecoder;
}));
export {
ArithmeticDecoder,
};

80
src/core/bidi.js

@ -13,22 +13,11 @@ @@ -13,22 +13,11 @@
* limitations under the License.
*/
'use strict';
import { warn } from '../shared/util';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/bidi', ['exports', 'pdfjs/shared/util'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'));
} else {
factory((root.pdfjsCoreBidi = {}), root.pdfjsSharedUtil);
}
}(this, function (exports, sharedUtil) {
var warn = sharedUtil.warn;
// Character types for symbols from 0000 to 00FF.
// Source: ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt
var baseTypes = [
// Character types for symbols from 0000 to 00FF.
// Source: ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt
var baseTypes = [
'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'S', 'B', 'S',
'WS', 'B', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN',
'BN', 'BN', 'BN', 'BN', 'B', 'B', 'B', 'S', 'WS', 'ON', 'ON', 'ET',
@ -49,15 +38,15 @@ @@ -49,15 +38,15 @@
'L', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L',
'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L',
'L', 'L', 'L', 'L', 'L', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L'
];
// Character types for symbols from 0600 to 06FF.
// Source: ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt
// Note that 061D does not exist in the Unicode standard (see
// http://unicode.org/charts/PDF/U0600.pdf), so we replace it with an
// empty string and issue a warning if we encounter this character. The
// empty string is required to properly index the items after it.
var arabicTypes = [
];
// Character types for symbols from 0600 to 06FF.
// Source: ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt
// Note that 061D does not exist in the Unicode standard (see
// http://unicode.org/charts/PDF/U0600.pdf), so we replace it with an
// empty string and issue a warning if we encounter this character. The
// empty string is required to properly index the items after it.
var arabicTypes = [
'AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'ON', 'ON', 'AL', 'ET', 'ET', 'AL',
'CS', 'AL', 'ON', 'ON', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM',
'NSM', 'NSM', 'NSM', 'NSM', 'AL', 'AL', '', 'AL', 'AL', 'AL', 'AL', 'AL',
@ -80,52 +69,52 @@ @@ -80,52 +69,52 @@
'ON', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'AL', 'AL', 'NSM', 'NSM',
'ON', 'NSM', 'NSM', 'NSM', 'NSM', 'AL', 'AL', 'EN', 'EN', 'EN', 'EN',
'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL'
];
];
function isOdd(i) {
function isOdd(i) {
return (i & 1) !== 0;
}
}
function isEven(i) {
function isEven(i) {
return (i & 1) === 0;
}
}
function findUnequal(arr, start, value) {
function findUnequal(arr, start, value) {
for (var j = start, jj = arr.length; j < jj; ++j) {
if (arr[j] !== value) {
return j;
}
}
return j;
}
}
function setValues(arr, start, end, value) {
function setValues(arr, start, end, value) {
for (var j = start; j < end; ++j) {
arr[j] = value;
}
}
}
function reverseValues(arr, start, end) {
function reverseValues(arr, start, end) {
for (var i = start, j = end - 1; i < j; ++i, --j) {
var temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
function createBidiText(str, isLTR, vertical) {
function createBidiText(str, isLTR, vertical) {
return {
str,
dir: (vertical ? 'ttb' : (isLTR ? 'ltr' : 'rtl'))
};
}
}
// These are used in bidi(), which is called frequently. We re-use them on
// each call to avoid unnecessary allocations.
var chars = [];
var types = [];
// These are used in bidi(), which is called frequently. We re-use them on
// each call to avoid unnecessary allocations.
var chars = [];
var types = [];
function bidi(str, startLevel, vertical) {
function bidi(str, startLevel, vertical) {
var isLTR = true;
var strLength = str.length;
if (strLength === 0 || vertical) {
@ -436,7 +425,8 @@ @@ -436,7 +425,8 @@
}
}
return createBidiText(chars.join(''), isLTR);
}
}
exports.bidi = bidi;
}));
export {
bidi,
};

58
src/core/cff_parser.js

@ -13,34 +13,13 @@ @@ -13,34 +13,13 @@
* limitations under the License.
*/
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/cff_parser', ['exports', 'pdfjs/shared/util',
'pdfjs/core/charsets', 'pdfjs/core/encodings'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./charsets.js'),
require('./encodings.js'));
} else {
factory((root.pdfjsCoreCFFParser = {}), root.pdfjsSharedUtil,
root.pdfjsCoreCharsets, root.pdfjsCoreEncodings);
}
}(this, function (exports, sharedUtil, coreCharsets, coreEncodings) {
var error = sharedUtil.error;
var info = sharedUtil.info;
var bytesToString = sharedUtil.bytesToString;
var warn = sharedUtil.warn;
var isArray = sharedUtil.isArray;
var Util = sharedUtil.Util;
var stringToBytes = sharedUtil.stringToBytes;
var assert = sharedUtil.assert;
var ISOAdobeCharset = coreCharsets.ISOAdobeCharset;
var ExpertCharset = coreCharsets.ExpertCharset;
var ExpertSubsetCharset = coreCharsets.ExpertSubsetCharset;
var StandardEncoding = coreEncodings.StandardEncoding;
var ExpertEncoding = coreEncodings.ExpertEncoding;
import {
assert, bytesToString, error, info, isArray, stringToBytes, Util, warn
} from '../shared/util';
import {
ExpertCharset, ExpertSubsetCharset, ISOAdobeCharset
} from './charsets';
import { ExpertEncoding, StandardEncoding } from './encodings';
// Maximum subroutine call depth of type 2 chartrings. Matches OTS.
var MAX_SUBR_NESTING = 10;
@ -1651,14 +1630,15 @@ var CFFCompiler = (function CFFCompilerClosure() { @@ -1651,14 +1630,15 @@ var CFFCompiler = (function CFFCompilerClosure() {
return CFFCompiler;
})();
exports.CFFStandardStrings = CFFStandardStrings;
exports.CFFParser = CFFParser;
exports.CFF = CFF;
exports.CFFHeader = CFFHeader;
exports.CFFStrings = CFFStrings;
exports.CFFIndex = CFFIndex;
exports.CFFCharset = CFFCharset;
exports.CFFTopDict = CFFTopDict;
exports.CFFPrivateDict = CFFPrivateDict;
exports.CFFCompiler = CFFCompiler;
}));
export {
CFFStandardStrings,
CFFParser,
CFF,
CFFHeader,
CFFStrings,
CFFIndex,
CFFCharset,
CFFTopDict,
CFFPrivateDict,
CFFCompiler,
};

21
src/core/charsets.js

@ -13,18 +13,6 @@ @@ -13,18 +13,6 @@
* limitations under the License.
*/
'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',
@ -125,7 +113,8 @@ var ExpertSubsetCharset = [ @@ -125,7 +113,8 @@ var ExpertSubsetCharset = [
'periodinferior', 'commainferior'
];
exports.ISOAdobeCharset = ISOAdobeCharset;
exports.ExpertCharset = ExpertCharset;
exports.ExpertSubsetCharset = ExpertSubsetCharset;
}));
export {
ISOAdobeCharset,
ExpertCharset,
ExpertSubsetCharset,
};

31
src/core/chunked_stream.js

@ -13,26 +13,10 @@ @@ -13,26 +13,10 @@
* limitations under the License.
*/
'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 arrayByteLength = sharedUtil.arrayByteLength;
var arraysToBytes = sharedUtil.arraysToBytes;
var assert = sharedUtil.assert;
var createPromiseCapability = sharedUtil.createPromiseCapability;
var isInt = sharedUtil.isInt;
var isEmptyObj = sharedUtil.isEmptyObj;
import {
arrayByteLength, arraysToBytes, assert, createPromiseCapability, isEmptyObj,
isInt, MissingDataException
} from '../shared/util';
var ChunkedStream = (function ChunkedStreamClosure() {
function ChunkedStream(length, chunkSize, manager) {
@ -578,6 +562,7 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() { @@ -578,6 +562,7 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
return ChunkedStreamManager;
})();
exports.ChunkedStream = ChunkedStream;
exports.ChunkedStreamManager = ChunkedStreamManager;
}));
export {
ChunkedStream,
ChunkedStreamManager,
};

46
src/core/cmap.js

@ -13,36 +13,13 @@ @@ -13,36 +13,13 @@
* limitations under the License.
*/
'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 warn = sharedUtil.warn;
var error = sharedUtil.error;
var isInt = sharedUtil.isInt;
var isString = sharedUtil.isString;
var MissingDataException = sharedUtil.MissingDataException;
var CMapCompressionType = sharedUtil.CMapCompressionType;
var isEOF = corePrimitives.isEOF;
var isName = corePrimitives.isName;
var isCmd = corePrimitives.isCmd;
var isStream = corePrimitives.isStream;
var Stream = coreStream.Stream;
var Lexer = coreParser.Lexer;
import {
assert, CMapCompressionType, error, isInt, isString, MissingDataException,
Util, warn
} from '../shared/util';
import { isCmd, isEOF, isName, isStream } from './primitives';
import { Lexer } from './parser';
import { Stream } from './stream';
var BUILT_IN_CMAPS = [
// << Start unicode maps.
@ -1010,7 +987,8 @@ var CMapFactory = (function CMapFactoryClosure() { @@ -1010,7 +987,8 @@ var CMapFactory = (function CMapFactoryClosure() {
};
})();
exports.CMap = CMap;
exports.CMapFactory = CMapFactory;
exports.IdentityCMap = IdentityCMap;
}));
export {
CMap,
IdentityCMap,
CMapFactory,
};

34
src/core/colorspace.js

@ -13,32 +13,9 @@ @@ -13,32 +13,9 @@
* limitations under the License.
*/
'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'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./primitives.js'),
require('./function.js'));
} else {
factory((root.pdfjsCoreColorSpace = {}), root.pdfjsSharedUtil,
root.pdfjsCorePrimitives, root.pdfjsCoreFunction);
}
}(this, function (exports, sharedUtil, corePrimitives, coreFunction) {
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;
import { error, info, isArray, isString, shadow, warn } from '../shared/util';
import { isDict, isName, isStream } from './primitives';
import { PDFFunction } from './function';
var ColorSpace = (function ColorSpaceClosure() {
/**
@ -1309,5 +1286,6 @@ var LabCS = (function LabCSClosure() { @@ -1309,5 +1286,6 @@ var LabCS = (function LabCSClosure() {
return LabCS;
})();
exports.ColorSpace = ColorSpace;
}));
export {
ColorSpace,
};

57
src/core/crypto.js

@ -13,34 +13,12 @@ @@ -13,34 +13,12 @@
* limitations under the License.
*/
'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 warn = sharedUtil.warn;
var error = sharedUtil.error;
var assert = sharedUtil.assert;
var isInt = sharedUtil.isInt;
var stringToBytes = sharedUtil.stringToBytes;
var utf8StringToString = sharedUtil.utf8StringToString;
var Name = corePrimitives.Name;
var isName = corePrimitives.isName;
var isDict = corePrimitives.isDict;
var DecryptStream = coreStream.DecryptStream;
import {
assert, bytesToString, error, isInt, PasswordException, PasswordResponses,
stringToBytes, utf8StringToString, warn
} from '../shared/util';
import { isDict, isName, Name } from './primitives';
import { DecryptStream } from './stream';
var ARCFourCipher = (function ARCFourCipherClosure() {
function ARCFourCipher(key) {
@ -2070,14 +2048,15 @@ var CipherTransformFactory = (function CipherTransformFactoryClosure() { @@ -2070,14 +2048,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;
}));
export {
AES128Cipher,
AES256Cipher,
ARCFourCipher,
CipherTransformFactory,
PDF17,
PDF20,
calculateMD5,
calculateSHA256,
calculateSHA384,
calculateSHA512,
};

71
src/core/document.js

@ -13,58 +13,18 @@ @@ -13,58 +13,18 @@
* limitations under the License.
*/
'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 OPS = sharedUtil.OPS;
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 isNum = sharedUtil.isNum;
var isString = sharedUtil.isString;
var shadow = sharedUtil.shadow;
var stringToBytes = sharedUtil.stringToBytes;
var stringToPDFString = sharedUtil.stringToPDFString;
var warn = sharedUtil.warn;
var isSpace = sharedUtil.isSpace;
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 Linearization = coreParser.Linearization;
var calculateMD5 = coreCrypto.calculateMD5;
var OperatorList = coreEvaluator.OperatorList;
var PartialEvaluator = coreEvaluator.PartialEvaluator;
var AnnotationFactory = coreAnnotation.AnnotationFactory;
import {
assert, error, info, isArray, isArrayBuffer, isNum, isSpace, isString,
MissingDataException, OPS, shadow, stringToBytes, stringToPDFString, Util,
warn
} from '../shared/util';
import { Catalog, ObjectLoader, XRef } from './obj';
import { Dict, isDict, isName, isStream } from './primitives';
import { NullStream, Stream, StreamsSequenceStream } from './stream';
import { OperatorList, PartialEvaluator } from './evaluator';
import { AnnotationFactory } from './annotation';
import { calculateMD5 } from './crypto';
import { Linearization } from './parser';
var Page = (function PageClosure() {
@ -648,6 +608,7 @@ var PDFDocument = (function PDFDocumentClosure() { @@ -648,6 +608,7 @@ var PDFDocument = (function PDFDocumentClosure() {
return PDFDocument;
})();
exports.Page = Page;
exports.PDFDocument = PDFDocument;
}));
export {
Page,
PDFDocument,
};

47
src/core/encodings.js

@ -13,19 +13,7 @@ @@ -13,19 +13,7 @@
* limitations under the License.
*/
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/encodings', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsCoreEncodings = {}));
}
}(this, function (exports) {
var ExpertEncoding = [
var ExpertEncoding = [
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
'space', 'exclamsmall', 'Hungarumlautsmall', '', 'dollaroldstyle',
@ -68,7 +56,7 @@ @@ -68,7 +56,7 @@
'Ucircumflexsmall', 'Udieresissmall', 'Yacutesmall', 'Thornsmall',
'Ydieresissmall'];
var MacExpertEncoding = [
var MacExpertEncoding = [
'', '', '', '', '', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
'space', 'exclamsmall', 'Hungarumlautsmall', 'centoldstyle',
@ -110,7 +98,7 @@ @@ -110,7 +98,7 @@
'Macronsmall', 'bsuperior', 'nsuperior', 'msuperior', 'commasuperior',
'periodsuperior', 'Dotaccentsmall', 'Ringsmall'];
var MacRomanEncoding = [
var MacRomanEncoding = [
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent',
@ -146,7 +134,7 @@ @@ -146,7 +134,7 @@
'tilde', 'macron', 'breve', 'dotaccent', 'ring', 'cedilla', 'hungarumlaut',
'ogonek', 'caron'];
var StandardEncoding = [
var StandardEncoding = [
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent',
@ -173,7 +161,7 @@ @@ -173,7 +161,7 @@
'', '', 'Lslash', 'Oslash', 'OE', 'ordmasculine', '', '', '', '', '', 'ae',
'', '', '', 'dotlessi', '', '', 'lslash', 'oslash', 'oe', 'germandbls'];
var WinAnsiEncoding = [
var WinAnsiEncoding = [
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent',
@ -209,7 +197,7 @@ @@ -209,7 +197,7 @@
'ugrave', 'uacute', 'ucircumflex', 'udieresis', 'yacute', 'thorn',
'ydieresis'];
var SymbolSetEncoding = [
var SymbolSetEncoding = [
'', '', '', '', '', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
'space', 'exclam', 'universal', 'numbersign', 'existential', 'percent',
@ -247,7 +235,7 @@ @@ -247,7 +235,7 @@
'bracketrightex', 'bracketrightbt', 'bracerighttp', 'bracerightmid',
'bracerightbt'];
var ZapfDingbatsEncoding = [
var ZapfDingbatsEncoding = [
'', '', '', '', '', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
'space', 'a1', 'a2', 'a202', 'a3', 'a4', 'a5', 'a119', 'a118', 'a117',
@ -273,7 +261,7 @@ @@ -273,7 +261,7 @@
'a199', 'a181', 'a200', 'a182', '', 'a201', 'a183', 'a184', 'a197', 'a185',
'a194', 'a198', 'a186', 'a195', 'a187', 'a188', 'a189', 'a190', 'a191'];
function getEncoding(encodingName) {
function getEncoding(encodingName) {
switch (encodingName) {
case 'WinAnsiEncoding':
return WinAnsiEncoding;
@ -292,13 +280,14 @@ @@ -292,13 +280,14 @@
default:
return null;
}
}
}
exports.WinAnsiEncoding = WinAnsiEncoding;
exports.StandardEncoding = StandardEncoding;
exports.MacRomanEncoding = MacRomanEncoding;
exports.SymbolSetEncoding = SymbolSetEncoding;
exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
exports.ExpertEncoding = ExpertEncoding;
exports.getEncoding = getEncoding;
}));
export {
WinAnsiEncoding,
StandardEncoding,
MacRomanEncoding,
SymbolSetEncoding,
ZapfDingbatsEncoding,
ExpertEncoding,
getEncoding,
};

135
src/core/evaluator.js

@ -13,101 +13,39 @@ @@ -13,101 +13,39 @@
* limitations under the License.
*/
'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',
'pdfjs/core/encodings', 'pdfjs/core/standard_fonts',
'pdfjs/core/unicode', 'pdfjs/core/glyphlist'], 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'),
require('./encodings.js'), require('./standard_fonts.js'),
require('./unicode.js'), require('./glyphlist.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,
root.pdfjsCoreEncodings, root.pdfjsCoreStandardFonts,
root.pdfjsCoreUnicode, root.pdfjsCoreGlyphList);
}
}(this, function (exports, sharedUtil, corePrimitives, coreStream, coreParser,
coreImage, coreColorSpace, coreMurmurHash3, coreFonts,
coreFunction, corePattern, coreCMap, coreMetrics, coreBidi,
coreEncodings, coreStandardFonts, coreUnicode,
coreGlyphList) {
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 NativeImageDecoding = sharedUtil.NativeImageDecoding;
var TextRenderingMode = sharedUtil.TextRenderingMode;
var CMapCompressionType = sharedUtil.CMapCompressionType;
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 getLookupTableFactory = sharedUtil.getLookupTableFactory;
var warn = sharedUtil.warn;
var Dict = corePrimitives.Dict;
var Name = corePrimitives.Name;
var isEOF = corePrimitives.isEOF;
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 Stream = coreStream.Stream;
var Lexer = coreParser.Lexer;
var Parser = coreParser.Parser;
var PDFImage = coreImage.PDFImage;
var ColorSpace = coreColorSpace.ColorSpace;
var MurmurHash3_64 = coreMurmurHash3.MurmurHash3_64;
var ErrorFont = coreFonts.ErrorFont;
var FontFlags = coreFonts.FontFlags;
var Font = coreFonts.Font;
var IdentityToUnicodeMap = coreFonts.IdentityToUnicodeMap;
var ToUnicodeMap = coreFonts.ToUnicodeMap;
var getFontType = coreFonts.getFontType;
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 getMetrics = coreMetrics.getMetrics;
var bidi = coreBidi.bidi;
var WinAnsiEncoding = coreEncodings.WinAnsiEncoding;
var StandardEncoding = coreEncodings.StandardEncoding;
var MacRomanEncoding = coreEncodings.MacRomanEncoding;
var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
var getEncoding = coreEncodings.getEncoding;
var getStdFontMap = coreStandardFonts.getStdFontMap;
var getSerifFonts = coreStandardFonts.getSerifFonts;
var getSymbolsFonts = coreStandardFonts.getSymbolsFonts;
var getNormalizedUnicodes = coreUnicode.getNormalizedUnicodes;
var reverseIfRtl = coreUnicode.reverseIfRtl;
var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
import {
assert, CMapCompressionType, createPromiseCapability, error,
FONT_IDENTITY_MATRIX, getLookupTableFactory, IDENTITY_MATRIX, ImageKind, info,
isArray, isNum, isString, NativeImageDecoding, OPS, TextRenderingMode,
UNSUPPORTED_FEATURES, Util, warn
} from '../shared/util';
import { CMapFactory, IdentityCMap } from './cmap';
import { DecodeStream, JpegStream, Stream } from './stream';
import {
Dict, isCmd, isDict, isEOF, isName, isRef, isStream, Name
} from './primitives';
import {
ErrorFont, Font, FontFlags, getFontType, IdentityToUnicodeMap, ToUnicodeMap
} from './fonts';
import {
getEncoding, MacRomanEncoding, StandardEncoding, SymbolSetEncoding,
WinAnsiEncoding, ZapfDingbatsEncoding
} from './encodings';
import {
getNormalizedUnicodes, getUnicodeForGlyph, reverseIfRtl
} from './unicode';
import {
getSerifFonts, getStdFontMap, getSymbolsFonts
} from './standard_fonts';
import { getTilingPatternIR, Pattern } from './pattern';
import { isPDFFunction, PDFFunction } from './function';
import { Lexer, Parser } from './parser';
import { bidi } from './bidi';
import { ColorSpace } from './colorspace';
import { getGlyphsUnicode } from './glyphlist';
import { getMetrics } from './metrics';
import { MurmurHash3_64 } from './murmurhash3';
import { PDFImage } from './image';
var PartialEvaluator = (function PartialEvaluatorClosure() {
const DefaultPartialEvaluatorOptions = {
@ -3439,6 +3377,7 @@ var QueueOptimizer = (function QueueOptimizerClosure() { @@ -3439,6 +3377,7 @@ var QueueOptimizer = (function QueueOptimizerClosure() {
return QueueOptimizer;
})();
exports.OperatorList = OperatorList;
exports.PartialEvaluator = PartialEvaluator;
}));
export {
OperatorList,
PartialEvaluator,
};

35
src/core/font_renderer.js

@ -13,31 +13,11 @@ @@ -13,31 +13,11 @@
* limitations under the License.
*/
'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', 'pdfjs/core/encodings',
'pdfjs/core/cff_parser'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./stream.js'),
require('./glyphlist.js'), require('./encodings.js'),
require('./cff_parser.js'));
} else {
factory((root.pdfjsCoreFontRenderer = {}), root.pdfjsSharedUtil,
root.pdfjsCoreStream, root.pdfjsCoreGlyphList, root.pdfjsCoreEncodings,
root.pdfjsCoreCFFParser);
}
}(this, function (exports, sharedUtil, coreStream, coreGlyphList,
coreEncodings, coreCFFParser) {
var Util = sharedUtil.Util;
var bytesToString = sharedUtil.bytesToString;
var error = sharedUtil.error;
var Stream = coreStream.Stream;
var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
var StandardEncoding = coreEncodings.StandardEncoding;
var CFFParser = coreCFFParser.CFFParser;
import { bytesToString, error, Util } from '../shared/util';
import { CFFParser } from './cff_parser';
import { getGlyphsUnicode } from './glyphlist';
import { StandardEncoding } from './encodings';
import { Stream } from './stream';
var FontRendererFactory = (function FontRendererFactoryClosure() {
function getLong(data, offset) {
@ -735,5 +715,6 @@ var FontRendererFactory = (function FontRendererFactoryClosure() { @@ -735,5 +715,6 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
};
})();
exports.FontRendererFactory = FontRendererFactory;
}));
export {
FontRendererFactory,
};

117
src/core/fonts.js

@ -13,76 +13,30 @@ @@ -13,76 +13,30 @@
* limitations under the License.
*/
'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/glyphlist',
'pdfjs/core/font_renderer', 'pdfjs/core/encodings',
'pdfjs/core/standard_fonts', 'pdfjs/core/unicode',
'pdfjs/core/type1_parser', 'pdfjs/core/cff_parser'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./primitives.js'),
require('./stream.js'), require('./glyphlist.js'),
require('./font_renderer.js'), require('./encodings.js'),
require('./standard_fonts.js'), require('./unicode.js'),
require('./type1_parser.js'), require('./cff_parser.js'));
} else {
factory((root.pdfjsCoreFonts = {}), root.pdfjsSharedUtil,
root.pdfjsCorePrimitives, root.pdfjsCoreStream, root.pdfjsCoreGlyphList,
root.pdfjsCoreFontRenderer, root.pdfjsCoreEncodings,
root.pdfjsCoreStandardFonts, root.pdfjsCoreUnicode,
root.pdfjsCoreType1Parser, root.pdfjsCoreCFFParser);
}
}(this, function (exports, sharedUtil, corePrimitives, coreStream,
coreGlyphList, coreFontRenderer, coreEncodings,
coreStandardFonts, coreUnicode, coreType1Parser,
coreCFFParser) {
var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
var FontType = sharedUtil.FontType;
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 string32 = sharedUtil.string32;
var warn = sharedUtil.warn;
var MissingDataException = sharedUtil.MissingDataException;
var isSpace = sharedUtil.isSpace;
var Stream = coreStream.Stream;
var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
var getDingbatsGlyphsUnicode = coreGlyphList.getDingbatsGlyphsUnicode;
var FontRendererFactory = coreFontRenderer.FontRendererFactory;
var StandardEncoding = coreEncodings.StandardEncoding;
var MacRomanEncoding = coreEncodings.MacRomanEncoding;
var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
var getEncoding = coreEncodings.getEncoding;
var getStdFontMap = coreStandardFonts.getStdFontMap;
var getNonStdFontMap = coreStandardFonts.getNonStdFontMap;
var getGlyphMapForStandardFonts = coreStandardFonts.getGlyphMapForStandardFonts;
var getSupplementalGlyphMapForArialBlack =
coreStandardFonts.getSupplementalGlyphMapForArialBlack;
var getUnicodeRangeFor = coreUnicode.getUnicodeRangeFor;
var mapSpecialUnicodeValues = coreUnicode.mapSpecialUnicodeValues;
var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
var Type1Parser = coreType1Parser.Type1Parser;
var CFFStandardStrings = coreCFFParser.CFFStandardStrings;
var CFFParser = coreCFFParser.CFFParser;
var CFFCompiler = coreCFFParser.CFFCompiler;
var CFF = coreCFFParser.CFF;
var CFFHeader = coreCFFParser.CFFHeader;
var CFFTopDict = coreCFFParser.CFFTopDict;
var CFFPrivateDict = coreCFFParser.CFFPrivateDict;
var CFFStrings = coreCFFParser.CFFStrings;
var CFFIndex = coreCFFParser.CFFIndex;
var CFFCharset = coreCFFParser.CFFCharset;
import {
assert, bytesToString, error, FONT_IDENTITY_MATRIX, FontType, info, isArray,
isInt, isNum, isSpace, MissingDataException, readUint32, shadow, string32,
warn
} from '../shared/util';
import {
CFF, CFFCharset, CFFCompiler, CFFHeader, CFFIndex, CFFParser, CFFPrivateDict,
CFFStandardStrings, CFFStrings, CFFTopDict
} from './cff_parser';
import { getDingbatsGlyphsUnicode, getGlyphsUnicode } from './glyphlist';
import {
getEncoding, MacRomanEncoding, StandardEncoding, SymbolSetEncoding,
ZapfDingbatsEncoding
} from './encodings';
import {
getGlyphMapForStandardFonts, getNonStdFontMap, getStdFontMap,
getSupplementalGlyphMapForArialBlack
} from './standard_fonts';
import {
getUnicodeForGlyph, getUnicodeRangeFor, mapSpecialUnicodeValues
} from './unicode';
import { FontRendererFactory } from './font_renderer';
import { Stream } from './stream';
import { Type1Parser } from './type1_parser';
// Unicode Private Use Area
var PRIVATE_USE_OFFSET_START = 0xE000;
@ -3376,14 +3330,15 @@ var CFFFont = (function CFFFontClosure() { @@ -3376,14 +3330,15 @@ var CFFFont = (function CFFFontClosure() {
}
})();
exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
exports.PRIVATE_USE_OFFSET_START = PRIVATE_USE_OFFSET_START;
exports.PRIVATE_USE_OFFSET_END = PRIVATE_USE_OFFSET_END;
exports.ErrorFont = ErrorFont;
exports.Font = Font;
exports.FontFlags = FontFlags;
exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
exports.ProblematicCharRanges = ProblematicCharRanges;
exports.ToUnicodeMap = ToUnicodeMap;
exports.getFontType = getFontType;
}));
export {
SEAC_ANALYSIS_ENABLED,
PRIVATE_USE_OFFSET_START,
PRIVATE_USE_OFFSET_END,
ErrorFont,
Font,
FontFlags,
ToUnicodeMap,
IdentityToUnicodeMap,
ProblematicCharRanges,
getFontType,
};

37
src/core/function.js

@ -13,29 +13,9 @@ @@ -13,29 +13,9 @@
* limitations under the License.
*/
'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;
import { error, info, isArray, isBool } from '../shared/util';
import { isDict, isStream } from './primitives';
import { PostScriptLexer, PostScriptParser } from './ps_parser';
var PDFFunction = (function PDFFunctionClosure() {
var CONSTRUCT_SAMPLED = 0;
@ -1152,8 +1132,9 @@ var PostScriptCompiler = (function PostScriptCompilerClosure() { @@ -1152,8 +1132,9 @@ var PostScriptCompiler = (function PostScriptCompilerClosure() {
return PostScriptCompiler;
})();
exports.isPDFFunction = isPDFFunction;
exports.PDFFunction = PDFFunction;
exports.PostScriptEvaluator = PostScriptEvaluator;
exports.PostScriptCompiler = PostScriptCompiler;
}));
export {
isPDFFunction,
PDFFunction,
PostScriptEvaluator,
PostScriptCompiler,
};

14
src/core/glyphlist.js

@ -14,18 +14,7 @@ @@ -14,18 +14,7 @@
*/
/* no-babel-preset */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/glyphlist', ['exports', 'pdfjs/shared/util'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'));
} else {
factory((root.pdfjsCoreGlyphList = {}), root.pdfjsSharedUtil);
}
}(this, function (exports, sharedUtil) {
var getLookupTableFactory = sharedUtil.getLookupTableFactory;
var getLookupTableFactory = require('../shared/util').getLookupTableFactory;
var getGlyphsUnicode = getLookupTableFactory(function (t) {
t['A'] = 0x0041;
@ -4561,4 +4550,3 @@ var getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) { @@ -4561,4 +4550,3 @@ var getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) {
exports.getGlyphsUnicode = getGlyphsUnicode;
exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode;
}));

41
src/core/image.js

@ -13,37 +13,11 @@ @@ -13,37 +13,11 @@
* limitations under the License.
*/
'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 JpegStream = coreStream.JpegStream;
var JpxImage = coreJpx.JpxImage;
import { assert, error, ImageKind, info, isArray, warn } from '../shared/util';
import { DecodeStream, JpegStream } from './stream';
import { isStream, Name } from './primitives';
import { ColorSpace } from './colorspace';
import { JpxImage } from './jpx';
var PDFImage = (function PDFImageClosure() {
/**
@ -664,5 +638,6 @@ var PDFImage = (function PDFImageClosure() { @@ -664,5 +638,6 @@ var PDFImage = (function PDFImageClosure() {
return PDFImage;
})();
exports.PDFImage = PDFImage;
}));
export {
PDFImage,
};

31
src/core/jbig2.js

@ -13,28 +13,10 @@ @@ -13,28 +13,10 @@
* limitations under the License.
*/
'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;
import {
error, log2, readInt8, readUint16, readUint32, shadow
} from '../shared/util';
import { ArithmeticDecoder } from './arithmetic_decoder';
var Jbig2Image = (function Jbig2ImageClosure() {
// Utility data structures
@ -1102,5 +1084,6 @@ var Jbig2Image = (function Jbig2ImageClosure() { @@ -1102,5 +1084,6 @@ var Jbig2Image = (function Jbig2ImageClosure() {
return Jbig2Image;
})();
exports.Jbig2Image = Jbig2Image;
}));
export {
Jbig2Image,
};

20
src/core/jpg.js

@ -14,20 +14,7 @@ @@ -14,20 +14,7 @@
*/
/* eslint-disable no-multi-spaces */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/jpg', ['exports', 'pdfjs/shared/util'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'));
} else {
factory((root.pdfjsCoreJpg = {}), root.pdfjsSharedUtil);
}
}(this, function (exports, sharedUtil) {
var warn = sharedUtil.warn;
var error = sharedUtil.error;
import { error, warn } from '../shared/util';
/**
* This code was forked from https://github.com/notmasteryet/jpgjs.
@ -1138,5 +1125,6 @@ var JpegImage = (function JpegImageClosure() { @@ -1138,5 +1125,6 @@ var JpegImage = (function JpegImageClosure() {
return JpegImage;
})();
exports.JpegImage = JpegImage;
}));
export {
JpegImage,
};

31
src/core/jpx.js

@ -13,28 +13,10 @@ @@ -13,28 +13,10 @@
* limitations under the License.
*/
'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 warn = sharedUtil.warn;
var error = sharedUtil.error;
var log2 = sharedUtil.log2;
var readUint16 = sharedUtil.readUint16;
var readUint32 = sharedUtil.readUint32;
var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
import {
error, info, log2, readUint16, readUint32, warn
} from '../shared/util';
import { ArithmeticDecoder } from './arithmetic_decoder';
var JpxImage = (function JpxImageClosure() {
// Table E.1
@ -2227,5 +2209,6 @@ var JpxImage = (function JpxImageClosure() { @@ -2227,5 +2209,6 @@ var JpxImage = (function JpxImageClosure() {
return JpxImage;
})();
exports.JpxImage = JpxImage;
}));
export {
JpxImage,
};

18
src/core/metrics.js

@ -13,18 +13,7 @@ @@ -13,18 +13,7 @@
* limitations under the License.
*/
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/metrics', ['exports', 'pdfjs/shared/util'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'));
} else {
factory((root.pdfjsCoreMetrics = {}), root.pdfjsSharedUtil);
}
}(this, function (exports, sharedUtil) {
var getLookupTableFactory = sharedUtil.getLookupTableFactory;
import { getLookupTableFactory } from '../shared/util';
// The Metrics object contains glyph widths (in glyph space units).
// As per PDF spec, for most fonts (Type 3 being an exception) a glyph
@ -2968,5 +2957,6 @@ var getMetrics = getLookupTableFactory(function (t) { @@ -2968,5 +2957,6 @@ var getMetrics = getLookupTableFactory(function (t) {
});
});
exports.getMetrics = getMetrics;
}));
export {
getMetrics,
};

17
src/core/murmurhash3.js

@ -17,18 +17,6 @@ @@ -17,18 +17,6 @@
* Hashes roughly 100 KB per millisecond on i7 3.4 GHz.
*/
'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 MurmurHash3_64 = (function MurmurHash3_64Closure(seed) {
// Workaround for missing math precision in JS.
var MASK_HIGH = 0xffff0000;
@ -152,5 +140,6 @@ var MurmurHash3_64 = (function MurmurHash3_64Closure(seed) { @@ -152,5 +140,6 @@ var MurmurHash3_64 = (function MurmurHash3_64Closure(seed) {
return MurmurHash3_64;
})();
exports.MurmurHash3_64 = MurmurHash3_64;
}));
export {
MurmurHash3_64,
};

88
src/core/network.js

@ -13,30 +13,21 @@ @@ -13,30 +13,21 @@
* limitations under the License.
*/
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/network', ['exports', 'pdfjs/shared/util',
'pdfjs/core/worker'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./worker.js'));
} else {
factory((root.pdfjsCoreNetwork = {}), root.pdfjsSharedUtil,
root.pdfjsCoreWorker);
}
}(this, function (exports, sharedUtil, coreWorker) {
import {
assert, createPromiseCapability, globalScope, isInt, MissingPDFException,
UnexpectedResponseException
} from '../shared/util';
import { setPDFNetworkStreamClass } from './worker';
if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
throw new Error('Module "pdfjs/core/network" shall not ' +
throw new Error('Module "./network" shall not ' +
'be used with FIREFOX or MOZCENTRAL build.');
}
var globalScope = sharedUtil.globalScope;
var OK_RESPONSE = 200;
var PARTIAL_CONTENT_RESPONSE = 206;
var OK_RESPONSE = 200;
var PARTIAL_CONTENT_RESPONSE = 206;
function NetworkManager(url, args) {
function NetworkManager(url, args) {
this.url = url;
args = args || {};
this.isHttp = /^https?:/i.test(url);
@ -50,9 +41,9 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) { @@ -50,9 +41,9 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
this.currXhrId = 0;
this.pendingRequests = Object.create(null);
this.loadedRequests = Object.create(null);
}
}
function getArrayBuffer(xhr) {
function getArrayBuffer(xhr) {
var data = xhr.response;
if (typeof data !== 'string') {
return data;
@ -63,9 +54,9 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) { @@ -63,9 +54,9 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
array[i] = data.charCodeAt(i) & 0xFF;
}
return array.buffer;
}
}
var supportsMozChunked =
var supportsMozChunked =
typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME') ? false :
(function supportsMozChunkedClosure() {
try {
@ -82,9 +73,9 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) { @@ -82,9 +73,9 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
} catch (e) {
return false;
}
})();
})();
NetworkManager.prototype = {
NetworkManager.prototype = {
requestRange: function NetworkManager_requestRange(begin, end, listeners) {
var args = {
begin,
@ -275,16 +266,10 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) { @@ -275,16 +266,10 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
delete this.pendingRequests[xhrId];
xhr.abort();
}
};
var assert = sharedUtil.assert;
var createPromiseCapability = sharedUtil.createPromiseCapability;
var isInt = sharedUtil.isInt;
var MissingPDFException = sharedUtil.MissingPDFException;
var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
};
/** @implements {IPDFStream} */
function PDFNetworkStream(options) {
/** @implements {IPDFStream} */
function PDFNetworkStream(options) {
this._options = options;
var source = options.source;
this._manager = new NetworkManager(source.url, {
@ -294,9 +279,9 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) { @@ -294,9 +279,9 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
this._rangeChunkSize = source.rangeChunkSize;
this._fullRequestReader = null;
this._rangeRequestReaders = [];
}
}
PDFNetworkStream.prototype = {
PDFNetworkStream.prototype = {
_onRangeRequestReaderClosed:
function PDFNetworkStream_onRangeRequestReaderClosed(reader) {
var i = this._rangeRequestReaders.indexOf(reader);
@ -329,10 +314,10 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) { @@ -329,10 +314,10 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
reader.cancel(reason);
});
}
};
};
/** @implements {IPDFStreamReader} */
function PDFNetworkStreamFullRequestReader(manager, options) {
/** @implements {IPDFStreamReader} */
function PDFNetworkStreamFullRequestReader(manager, options) {
this._manager = manager;
var source = options.source;
@ -363,9 +348,9 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) { @@ -363,9 +348,9 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
this._storedError = undefined;
this.onProgress = null;
}
}
PDFNetworkStreamFullRequestReader.prototype = {
PDFNetworkStreamFullRequestReader.prototype = {
_validateRangeRequestCapabilities: function
PDFNetworkStreamFullRequestReader_validateRangeRequestCapabilities() {
@ -528,10 +513,10 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) { @@ -528,10 +513,10 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
}
this._fullRequestReader = null;
}
};
};
/** @implements {IPDFStreamRangeReader} */
function PDFNetworkStreamRangeRequestReader(manager, begin, end) {
/** @implements {IPDFStreamRangeReader} */
function PDFNetworkStreamRangeRequestReader(manager, begin, end) {
this._manager = manager;
var args = {
onDone: this._onDone.bind(this),
@ -544,9 +529,9 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) { @@ -544,9 +529,9 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
this.onProgress = null;
this.onClosed = null;
}
}
PDFNetworkStreamRangeRequestReader.prototype = {
PDFNetworkStreamRangeRequestReader.prototype = {
_close: function PDFNetworkStreamRangeRequestReader_close() {
if (this.onClosed) {
this.onClosed(this);
@ -606,10 +591,11 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) { @@ -606,10 +591,11 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
}
this._close();
}
};
};
coreWorker.setPDFNetworkStreamClass(PDFNetworkStream);
setPDFNetworkStreamClass(PDFNetworkStream);
exports.PDFNetworkStream = PDFNetworkStream;
exports.NetworkManager = NetworkManager;
}));
export {
PDFNetworkStream,
NetworkManager,
};

77
src/core/obj.js

@ -13,58 +13,20 @@ @@ -13,58 +13,20 @@
* limitations under the License.
*/
'use strict';
(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', 'pdfjs/core/colorspace'], 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'), require('./colorspace.js'));
} else {
factory((root.pdfjsCoreObj = {}), root.pdfjsSharedUtil,
root.pdfjsCorePrimitives, root.pdfjsCoreCrypto, root.pdfjsCoreParser,
root.pdfjsCoreChunkedStream, root.pdfjsCoreColorSpace);
}
}(this, function (exports, sharedUtil, corePrimitives, coreCrypto, coreParser,
coreChunkedStream, coreColorSpace) {
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 isBool = sharedUtil.isBool;
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 createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
var Util = sharedUtil.Util;
var Dict = corePrimitives.Dict;
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 isRefsEqual = corePrimitives.isRefsEqual;
var isStream = corePrimitives.isStream;
var CipherTransformFactory = coreCrypto.CipherTransformFactory;
var Lexer = coreParser.Lexer;
var Parser = coreParser.Parser;
var ChunkedStream = coreChunkedStream.ChunkedStream;
var ColorSpace = coreColorSpace.ColorSpace;
import {
assert, bytesToString, createPromiseCapability, createValidAbsoluteUrl, error,
info, InvalidPDFException, isArray, isBool, isInt, isString,
MissingDataException, shadow, stringToPDFString, stringToUTF8String, Util,
warn, XRefParseException
} from '../shared/util';
import {
Dict, isCmd, isDict, isName, isRef, isRefsEqual, isStream, Ref, RefSet,
RefSetCache
} from './primitives';
import { Lexer, Parser } from './parser';
import { ChunkedStream } from './chunked_stream';
import { CipherTransformFactory } from './crypto';
import { ColorSpace } from './colorspace';
var Catalog = (function CatalogClosure() {
function Catalog(pdfManager, xref, pageFactory) {
@ -1788,8 +1750,9 @@ var ObjectLoader = (function() { @@ -1788,8 +1750,9 @@ var ObjectLoader = (function() {
return ObjectLoader;
})();
exports.Catalog = Catalog;
exports.ObjectLoader = ObjectLoader;
exports.XRef = XRef;
exports.FileSpec = FileSpec;
}));
export {
Catalog,
ObjectLoader,
XRef,
FileSpec,
};

65
src/core/parser.js

@ -13,51 +13,17 @@ @@ -13,51 +13,17 @@
* limitations under the License.
*/
'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 EOF = corePrimitives.EOF;
var Cmd = corePrimitives.Cmd;
var Dict = corePrimitives.Dict;
var Name = corePrimitives.Name;
var Ref = corePrimitives.Ref;
var isEOF = corePrimitives.isEOF;
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;
import {
Ascii85Stream, AsciiHexStream, CCITTFaxStream, FlateStream, Jbig2Stream,
JpegStream, JpxStream, LZWStream, NullStream, PredictorStream, RunLengthStream
} from './stream';
import {
assert, error, info, isArray, isInt, isNum, isString, MissingDataException,
StreamType, warn
} from '../shared/util';
import {
Cmd, Dict, EOF, isCmd, isDict, isEOF, isName, Name, Ref
} from './primitives';
var MAX_LENGTH_TO_CACHE = 1000;
@ -1125,7 +1091,8 @@ var Linearization = { @@ -1125,7 +1091,8 @@ var Linearization = {
}
};
exports.Lexer = Lexer;
exports.Linearization = Linearization;
exports.Parser = Parser;
}));
export {
Lexer,
Linearization,
Parser,
};

41
src/core/pattern.js

@ -14,34 +14,12 @@ @@ -14,34 +14,12 @@
*/
/* eslint-disable no-multi-spaces */
'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;
import {
assert, error, info, MissingDataException, UNSUPPORTED_FEATURES, Util, warn
} from '../shared/util';
import { ColorSpace } from './colorspace';
import { isStream } from './primitives';
import { PDFFunction } from './function';
var ShadingType = {
FUNCTION_BASED: 1,
@ -830,6 +808,7 @@ function getTilingPatternIR(operatorList, dict, args) { @@ -830,6 +808,7 @@ function getTilingPatternIR(operatorList, dict, args) {
];
}
exports.Pattern = Pattern;
exports.getTilingPatternIR = getTilingPatternIR;
}));
export {
Pattern,
getTilingPatternIR,
};

42
src/core/pdf_manager.js

@ -13,34 +13,13 @@ @@ -13,34 +13,13 @@
* limitations under the License.
*/
'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 warn = sharedUtil.warn;
var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
var shadow = sharedUtil.shadow;
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;
import {
createPromiseCapability, createValidAbsoluteUrl, MissingDataException,
NotImplementedException, shadow, Util, warn
} from '../shared/util';
import { ChunkedStreamManager } from './chunked_stream';
import { PDFDocument } from './document';
import { Stream } from './stream';
var BasePdfManager = (function BasePdfManagerClosure() {
function BasePdfManager() {
@ -246,6 +225,7 @@ var NetworkPdfManager = (function NetworkPdfManagerClosure() { @@ -246,6 +225,7 @@ var NetworkPdfManager = (function NetworkPdfManagerClosure() {
return NetworkPdfManager;
})();
exports.LocalPdfManager = LocalPdfManager;
exports.NetworkPdfManager = NetworkPdfManager;
}));
export {
LocalPdfManager,
NetworkPdfManager,
};

45
src/core/primitives.js

@ -14,19 +14,7 @@ @@ -14,19 +14,7 @@
*/
/* 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;
import { isArray } from '../shared/util';
var EOF = {};
@ -299,18 +287,19 @@ function isStream(v) { @@ -299,18 +287,19 @@ function isStream(v) {
return typeof v === 'object' && v !== null && v.getBytes !== undefined;
}
exports.EOF = EOF;
exports.Cmd = Cmd;
exports.Dict = Dict;
exports.Name = Name;
exports.Ref = Ref;
exports.RefSet = RefSet;
exports.RefSetCache = RefSetCache;
exports.isEOF = isEOF;
exports.isCmd = isCmd;
exports.isDict = isDict;
exports.isName = isName;
exports.isRef = isRef;
exports.isRefsEqual = isRefsEqual;
exports.isStream = isStream;
}));
export {
EOF,
Cmd,
Dict,
Name,
Ref,
RefSet,
RefSetCache,
isEOF,
isCmd,
isDict,
isName,
isRef,
isRefsEqual,
isStream,
};

26
src/core/ps_parser.js

@ -13,23 +13,8 @@ @@ -13,23 +13,8 @@
* limitations under the License.
*/
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/ps_parser', ['exports', 'pdfjs/shared/util',
'pdfjs/core/primitives'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./primitives.js'));
} else {
factory((root.pdfjsCorePsParser = {}), root.pdfjsSharedUtil,
root.pdfjsCorePrimitives);
}
}(this, function (exports, sharedUtil, corePrimitives) {
var error = sharedUtil.error;
var isSpace = sharedUtil.isSpace;
var EOF = corePrimitives.EOF;
import { error, isSpace } from '../shared/util';
import { EOF } from './primitives';
var PostScriptParser = (function PostScriptParserClosure() {
function PostScriptParser(lexer) {
@ -234,6 +219,7 @@ var PostScriptLexer = (function PostScriptLexerClosure() { @@ -234,6 +219,7 @@ var PostScriptLexer = (function PostScriptLexerClosure() {
return PostScriptLexer;
})();
exports.PostScriptLexer = PostScriptLexer;
exports.PostScriptParser = PostScriptParser;
}));
export {
PostScriptLexer,
PostScriptParser,
};

70
src/core/standard_fonts.js

@ -13,25 +13,13 @@ @@ -13,25 +13,13 @@
* limitations under the License.
*/
'use strict';
import { getLookupTableFactory } from '../shared/util';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/standard_fonts', ['exports', 'pdfjs/shared/util'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'));
} else {
factory((root.pdfjsCoreStandardFonts = {}), root.pdfjsSharedUtil);
}
}(this, function (exports, sharedUtil) {
var getLookupTableFactory = sharedUtil.getLookupTableFactory;
/**
/**
* Hold a map of decoded fonts and of the standard fourteen Type1
* fonts and their acronyms.
*/
var getStdFontMap = getLookupTableFactory(function (t) {
var getStdFontMap = getLookupTableFactory(function (t) {
t['ArialNarrow'] = 'Helvetica';
t['ArialNarrow-Bold'] = 'Helvetica-Bold';
t['ArialNarrow-BoldItalic'] = 'Helvetica-BoldOblique';
@ -87,13 +75,13 @@ @@ -87,13 +75,13 @@
t['TimesNewRomanPSMT-Bold'] = 'Times-Bold';
t['TimesNewRomanPSMT-BoldItalic'] = 'Times-BoldItalic';
t['TimesNewRomanPSMT-Italic'] = 'Times-Italic';
});
});
/**
/**
* Holds the map of the non-standard fonts that might be included as
* a standard fonts without glyph data.
*/
var getNonStdFontMap = getLookupTableFactory(function (t) {
var getNonStdFontMap = getLookupTableFactory(function (t) {
t['CenturyGothic'] = 'Helvetica';
t['CenturyGothic-Bold'] = 'Helvetica-Bold';
t['CenturyGothic-BoldItalic'] = 'Helvetica-BoldOblique';
@ -124,9 +112,9 @@ @@ -124,9 +112,9 @@
t['MS-PMincho-Italic'] = 'MS PMincho-Italic';
t['NuptialScript'] = 'Times-Italic';
t['Wingdings'] = 'ZapfDingbats';
});
});
var getSerifFonts = getLookupTableFactory(function (t) {
var getSerifFonts = getLookupTableFactory(function (t) {
t['Adobe Jenson'] = true;
t['Adobe Text'] = true;
t['Albertus'] = true;
@ -260,18 +248,18 @@ @@ -260,18 +248,18 @@
t['Wide Latin'] = true;
t['Windsor'] = true;
t['XITS'] = true;
});
});
var getSymbolsFonts = getLookupTableFactory(function (t) {
var getSymbolsFonts = getLookupTableFactory(function (t) {
t['Dingbats'] = true;
t['Symbol'] = true;
t['ZapfDingbats'] = true;
});
});
// Glyph map for well-known standard fonts. Sometimes Ghostscript uses CID
// fonts, but does not embed the CID to GID mapping. The mapping is incomplete
// for all glyphs, but common for some set of the standard fonts.
var getGlyphMapForStandardFonts = getLookupTableFactory(function (t) {
// Glyph map for well-known standard fonts. Sometimes Ghostscript uses CID
// fonts, but does not embed the CID to GID mapping. The mapping is incomplete
// for all glyphs, but common for some set of the standard fonts.
var getGlyphMapForStandardFonts = getLookupTableFactory(function (t) {
t[2] = 10; t[3] = 32; t[4] = 33; t[5] = 34; t[6] = 35; t[7] = 36; t[8] = 37;
t[9] = 38; t[10] = 39; t[11] = 40; t[12] = 41; t[13] = 42; t[14] = 43;
t[15] = 44; t[16] = 45; t[17] = 46; t[18] = 47; t[19] = 48; t[20] = 49;
@ -356,21 +344,21 @@ @@ -356,21 +344,21 @@
t[3173] = 1278; t[3174] = 1279; t[3181] = 7622; t[3182] = 7623;
t[3282] = 11799; t[3316] = 578; t[3379] = 42785; t[3393] = 1159;
t[3416] = 8377;
});
});
// The glyph map for ArialBlack differs slightly from the glyph map used for
// other well-known standard fonts. Hence we use this (incomplete) CID to GID
// mapping to adjust the glyph map for non-embedded ArialBlack fonts.
var getSupplementalGlyphMapForArialBlack =
// The glyph map for ArialBlack differs slightly from the glyph map used for
// other well-known standard fonts. Hence we use this (incomplete) CID to GID
// mapping to adjust the glyph map for non-embedded ArialBlack fonts.
var getSupplementalGlyphMapForArialBlack =
getLookupTableFactory(function (t) {
t[227] = 322; t[264] = 261; t[291] = 346;
});
});
exports.getStdFontMap = getStdFontMap;
exports.getNonStdFontMap = getNonStdFontMap;
exports.getSerifFonts = getSerifFonts;
exports.getSymbolsFonts = getSymbolsFonts;
exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
exports.getSupplementalGlyphMapForArialBlack =
getSupplementalGlyphMapForArialBlack;
}));
export {
getStdFontMap,
getNonStdFontMap,
getSerifFonts,
getSymbolsFonts,
getGlyphMapForStandardFonts,
getSupplementalGlyphMapForArialBlack,
};

74
src/core/stream.js

@ -13,38 +13,13 @@ @@ -13,38 +13,13 @@
* limitations under the License.
*/
'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 isInt = sharedUtil.isInt;
var isArray = sharedUtil.isArray;
var createObjectURL = sharedUtil.createObjectURL;
var shadow = sharedUtil.shadow;
var isSpace = sharedUtil.isSpace;
var Dict = corePrimitives.Dict;
var isDict = corePrimitives.isDict;
var isStream = corePrimitives.isStream;
var Jbig2Image = coreJbig2.Jbig2Image;
var JpegImage = coreJpg.JpegImage;
var JpxImage = coreJpx.JpxImage;
import {
createObjectURL, error, info, isArray, isInt, isSpace, shadow, Util
} from '../shared/util';
import { Dict, isDict, isStream } from './primitives';
import { Jbig2Image } from './jbig2';
import { JpegImage } from './jpg';
import { JpxImage } from './jpx';
var Stream = (function StreamClosure() {
function Stream(arrayBuffer, start, length, dict) {
@ -2476,20 +2451,21 @@ var NullStream = (function NullStreamClosure() { @@ -2476,20 +2451,21 @@ var NullStream = (function NullStreamClosure() {
return NullStream;
})();
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;
}));
export {
Ascii85Stream,
AsciiHexStream,
CCITTFaxStream,
DecryptStream,
DecodeStream,
FlateStream,
Jbig2Stream,
JpegStream,
JpxStream,
NullStream,
PredictorStream,
RunLengthStream,
Stream,
StreamsSequenceStream,
StringStream,
LZWStream,
};

27
src/core/type1_parser.js

@ -13,25 +13,9 @@ @@ -13,25 +13,9 @@
* limitations under the License.
*/
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/type1_parser', ['exports', 'pdfjs/shared/util',
'pdfjs/core/stream', 'pdfjs/core/encodings'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./stream.js'),
require('./encodings.js'));
} else {
factory((root.pdfjsCoreType1Parser = {}), root.pdfjsSharedUtil,
root.pdfjsCoreStream, root.pdfjsCoreEncodings);
}
}(this, function (exports, sharedUtil, coreStream, coreEncodings) {
var warn = sharedUtil.warn;
var isSpace = sharedUtil.isSpace;
var Stream = coreStream.Stream;
var getEncoding = coreEncodings.getEncoding;
import { isSpace, warn } from '../shared/util';
import { getEncoding } from './encodings';
import { Stream } from './stream';
// Hinting is currently disabled due to unknown problems on windows
// in tracemonkey and various other pdfs with type1 fonts.
@ -717,5 +701,6 @@ var Type1Parser = (function Type1ParserClosure() { @@ -717,5 +701,6 @@ var Type1Parser = (function Type1ParserClosure() {
return Type1Parser;
})();
exports.Type1Parser = Type1Parser;
}));
export {
Type1Parser,
};

66
src/core/unicode.js

@ -14,23 +14,12 @@ @@ -14,23 +14,12 @@
*/
/* no-babel-preset */
'use strict';
var getLookupTableFactory = require('../shared/util').getLookupTableFactory;
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/unicode', ['exports', 'pdfjs/shared/util'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'));
} else {
factory((root.pdfjsCoreUnicode = {}), root.pdfjsSharedUtil);
}
}(this, function (exports, sharedUtil) {
var getLookupTableFactory = sharedUtil.getLookupTableFactory;
// Some characters, e.g. copyrightserif, are mapped to the private use area
// and might not be displayed using standard fonts. Mapping/hacking well-known
// chars to the similar equivalents in the normal characters range.
var getSpecialPUASymbols = getLookupTableFactory(function (t) {
// Some characters, e.g. copyrightserif, are mapped to the private use area
// and might not be displayed using standard fonts. Mapping/hacking well-known
// chars to the similar equivalents in the normal characters range.
var getSpecialPUASymbols = getLookupTableFactory(function (t) {
t[63721] = 0x00A9; // copyrightsans (0xF8E9) => copyright
t[63193] = 0x00A9; // copyrightserif (0xF6D9) => copyright
t[63720] = 0x00AE; // registersans (0xF8E8) => registered
@ -55,18 +44,18 @@ @@ -55,18 +44,18 @@
t[63734] = 0x239E; // parenrighttp (0xF8F6)
t[63735] = 0x239F; // parenrightex (0xF8F7)
t[63736] = 0x23A0; // parenrightbt (0xF8F8)
});
});
function mapSpecialUnicodeValues(code) {
function mapSpecialUnicodeValues(code) {
if (code >= 0xFFF0 && code <= 0xFFFF) { // Specials unicode block.
return 0;
} else if (code >= 0xF600 && code <= 0xF8FF) {
return (getSpecialPUASymbols()[code] || code);
}
return code;
}
}
function getUnicodeForGlyph(name, glyphsUnicodeMap) {
function getUnicodeForGlyph(name, glyphsUnicodeMap) {
var unicode = glyphsUnicodeMap[name];
if (unicode !== undefined) {
return unicode;
@ -94,9 +83,9 @@ @@ -94,9 +83,9 @@
}
}
return -1;
}
}
var UnicodeRanges = [
var UnicodeRanges = [
{ 'begin': 0x0000, 'end': 0x007F }, // Basic Latin
{ 'begin': 0x0080, 'end': 0x00FF }, // Latin-1 Supplement
{ 'begin': 0x0100, 'end': 0x017F }, // Latin Extended-A
@ -220,9 +209,9 @@ @@ -220,9 +209,9 @@
{ 'begin': 0x101D0, 'end': 0x101FF }, // Phaistos Disc
{ 'begin': 0x102A0, 'end': 0x102DF }, // Carian
{ 'begin': 0x1F030, 'end': 0x1F09F } // Domino Tiles
];
];
function getUnicodeRangeFor(value) {
function getUnicodeRangeFor(value) {
for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) {
var range = UnicodeRanges[i];
if (value >= range.begin && value < range.end) {
@ -230,9 +219,9 @@ @@ -230,9 +219,9 @@
}
}
return -1;
}
}
function isRTLRangeFor(value) {
function isRTLRangeFor(value) {
var range = UnicodeRanges[13];
if (value >= range.begin && value < range.end) {
return true;
@ -242,11 +231,11 @@ @@ -242,11 +231,11 @@
return true;
}
return false;
}
}
// The normalization table is obtained by filtering the Unicode characters
// database with <compat> entries.
var getNormalizedUnicodes = getLookupTableFactory(function (t) {
// The normalization table is obtained by filtering the Unicode characters
// database with <compat> entries.
var getNormalizedUnicodes = getLookupTableFactory(function (t) {
t['\u00A8'] = '\u0020\u0308';
t['\u00AF'] = '\u0020\u0304';
t['\u00B4'] = '\u0020\u0301';
@ -1624,9 +1613,9 @@ @@ -1624,9 +1613,9 @@
t['\uFEFA'] = '\u0644\u0625';
t['\uFEFB'] = '\u0644\u0627';
t['\uFEFC'] = '\u0644\u0627';
});
});
function reverseIfRtl(chars) {
function reverseIfRtl(chars) {
var charsLength = chars.length;
// Reverse an arabic ligature.
if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
@ -1637,11 +1626,10 @@ @@ -1637,11 +1626,10 @@
s += chars[ii];
}
return s;
}
}
exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues;
exports.reverseIfRtl = reverseIfRtl;
exports.getUnicodeRangeFor = getUnicodeRangeFor;
exports.getNormalizedUnicodes = getNormalizedUnicodes;
exports.getUnicodeForGlyph = getUnicodeForGlyph;
}));
exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues;
exports.reverseIfRtl = reverseIfRtl;
exports.getUnicodeRangeFor = getUnicodeRangeFor;
exports.getNormalizedUnicodes = getNormalizedUnicodes;
exports.getUnicodeForGlyph = getUnicodeForGlyph;

54
src/core/worker.js

@ -13,41 +13,14 @@ @@ -13,41 +13,14 @@
* limitations under the License.
*/
'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'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./primitives.js'),
require('./pdf_manager.js'));
} else {
factory((root.pdfjsCoreWorker = {}), root.pdfjsSharedUtil,
root.pdfjsCorePrimitives, root.pdfjsCorePdfManager);
}
}(this, function (exports, sharedUtil, corePrimitives, corePdfManager) {
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 UnknownErrorException = sharedUtil.UnknownErrorException;
var XRefParseException = sharedUtil.XRefParseException;
var arrayByteLength = sharedUtil.arrayByteLength;
var arraysToBytes = sharedUtil.arraysToBytes;
var assert = sharedUtil.assert;
var createPromiseCapability = sharedUtil.createPromiseCapability;
var info = sharedUtil.info;
var warn = sharedUtil.warn;
var setVerbosityLevel = sharedUtil.setVerbosityLevel;
var isNodeJS = sharedUtil.isNodeJS;
var Ref = corePrimitives.Ref;
var LocalPdfManager = corePdfManager.LocalPdfManager;
var NetworkPdfManager = corePdfManager.NetworkPdfManager;
import {
arrayByteLength, arraysToBytes, assert, createPromiseCapability, info,
InvalidPDFException, isNodeJS, MessageHandler, MissingPDFException,
PasswordException, setVerbosityLevel, UnexpectedResponseException,
UnknownErrorException, UNSUPPORTED_FEATURES, warn, XRefParseException
} from '../shared/util';
import { LocalPdfManager, NetworkPdfManager } from './pdf_manager';
import { Ref } from './primitives';
var WorkerTask = (function WorkerTaskClosure() {
function WorkerTask(name) {
@ -568,7 +541,7 @@ var WorkerMessageHandler = { @@ -568,7 +541,7 @@ var WorkerMessageHandler = {
if (source.chunkedViewerLoading) {
pdfStream = new PDFWorkerStream(source, handler);
} else {
assert(PDFNetworkStream, 'pdfjs/core/network module is not loaded');
assert(PDFNetworkStream, './network module is not loaded');
pdfStream = new PDFNetworkStream(data);
}
} catch (ex) {
@ -982,7 +955,8 @@ if (typeof window === 'undefined' && !isNodeJS() && @@ -982,7 +955,8 @@ if (typeof window === 'undefined' && !isNodeJS() &&
WorkerMessageHandler.initializeFromPort(self);
}
exports.setPDFNetworkStreamClass = setPDFNetworkStreamClass;
exports.WorkerTask = WorkerTask;
exports.WorkerMessageHandler = WorkerMessageHandler;
}));
export {
setPDFNetworkStreamClass,
WorkerTask,
WorkerMessageHandler,
};

1
src/main_loader.js

@ -68,4 +68,5 @@ @@ -68,4 +68,5 @@
displayDOMUtils.RenderingCancelledException;
exports.getFilenameFromUrl = displayDOMUtils.getFilenameFromUrl;
exports.addLinkAttributes = displayDOMUtils.addLinkAttributes;
exports.StatTimer = sharedUtil.StatTimer;
}));

1
src/pdf.js

@ -57,3 +57,4 @@ exports.RenderingCancelledException = @@ -57,3 +57,4 @@ exports.RenderingCancelledException =
pdfjsDisplayDOMUtils.RenderingCancelledException;
exports.getFilenameFromUrl = pdfjsDisplayDOMUtils.getFilenameFromUrl;
exports.addLinkAttributes = pdfjsDisplayDOMUtils.addLinkAttributes;
exports.StatTimer = pdfjsSharedUtil.StatTimer;

8
test/driver.js

@ -12,13 +12,15 @@ @@ -12,13 +12,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFJS, pdfjsSharedUtil */
/* globals PDFJS, pdfjsDistBuildPdf */
'use strict';
var WAITING_TIME = 100; // ms
var PDF_TO_CSS_UNITS = 96.0 / 72.0;
var StatTimer = pdfjsDistBuildPdf.StatTimer;
/**
* @class
*/
@ -258,7 +260,7 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars @@ -258,7 +260,7 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars
*/
function Driver(options) {
// Configure the global PDFJS object
PDFJS.workerSrc = '../src/worker_loader.js';
PDFJS.workerSrc = '../build/generic/build/pdf.worker.js';
PDFJS.cMapPacked = true;
PDFJS.cMapUrl = '../external/bcmaps/';
PDFJS.enableStats = true;
@ -547,7 +549,7 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars @@ -547,7 +549,7 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars
}
page.cleanup();
task.stats = page.stats;
page.stats = new pdfjsSharedUtil.StatTimer();
page.stats = new StatTimer();
self._snapshot(task, error);
});
initPromise.then(function () {

12
test/test_slave.html

@ -18,8 +18,7 @@ limitations under the License. @@ -18,8 +18,7 @@ limitations under the License.
<head>
<title>PDF.js test slave</title>
<meta charset="utf-8">
<script src="../node_modules/systemjs/dist/system.js"></script>
<script src="../systemjs.config.js"></script>
<script src="../build/generic/build/pdf.js"></script>
<script src="driver.js"></script>
</head>
<body>
@ -32,14 +31,6 @@ limitations under the License. @@ -32,14 +31,6 @@ limitations under the License.
<div id="end"></div>
</body>
<script>
Promise.all([SystemJS.import('pdfjs/display/api'),
SystemJS.import('pdfjs/display/text_layer'),
SystemJS.import('pdfjs/display/annotation_layer'),
SystemJS.import('pdfjs/display/global'),
SystemJS.import('pdfjs/shared/util')])
.then(function (modules) {
window.pdfjsSharedUtil = modules[4];
var driver = new Driver({
disableScrolling: document.getElementById('disableScrolling'),
inflight: document.getElementById('inflight'),
@ -47,6 +38,5 @@ limitations under the License. @@ -47,6 +38,5 @@ limitations under the License.
end: document.getElementById('end')
});
driver.run();
});
</script>
</html>

2
test/unit/jasmine-boot.js

@ -60,7 +60,7 @@ function initializePDFJS(callback) { @@ -60,7 +60,7 @@ function initializePDFJS(callback) {
var displayGlobal = modules[0];
// Configure the worker.
displayGlobal.PDFJS.workerSrc = '../../src/worker_loader.js';
displayGlobal.PDFJS.workerSrc = '../../build/generic/build/pdf.worker.js';
// Opt-in to using the latest API.
displayGlobal.PDFJS.pdfjsNext = true;

Loading…
Cancel
Save