Browse Source

PDF.js version 1.1.343

master v1.1.343
Pdf Bot 10 years ago
parent
commit
6be0911b87
  1. 2
      bower.json
  2. 127
      build/pdf.combined.js
  3. 4
      build/pdf.js
  4. 127
      build/pdf.worker.js
  5. 2
      package.json

2
bower.json

@ -1,6 +1,6 @@
{ {
"name": "pdfjs-dist", "name": "pdfjs-dist",
"version": "1.1.341", "version": "1.1.343",
"main": [ "main": [
"build/pdf.js", "build/pdf.js",
"build/pdf.worker.js" "build/pdf.worker.js"

127
build/pdf.combined.js

@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {}; (typeof window !== 'undefined' ? window : this).PDFJS = {};
} }
PDFJS.version = '1.1.341'; PDFJS.version = '1.1.343';
PDFJS.build = 'd08895d'; PDFJS.build = 'e876dd8';
(function pdfjsWrapper() { (function pdfjsWrapper() {
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it
@ -9221,10 +9221,12 @@ var Page = (function PageClosure() {
get annotations() { get annotations() {
var annotations = []; var annotations = [];
var annotationRefs = this.getInheritedPageProp('Annots') || []; var annotationRefs = this.getInheritedPageProp('Annots') || [];
var annotationFactory = new AnnotationFactory();
for (var i = 0, n = annotationRefs.length; i < n; ++i) { for (var i = 0, n = annotationRefs.length; i < n; ++i) {
var annotationRef = annotationRefs[i]; var annotationRef = annotationRefs[i];
var annotation = Annotation.fromRef(this.xref, annotationRef); var annotation = annotationFactory.create(this.xref, annotationRef);
if (annotation) { if (annotation &&
(annotation.isViewable() || annotation.isPrintable())) {
annotations.push(annotation); annotations.push(annotation);
} }
} }
@ -11303,7 +11305,54 @@ var ExpertSubsetCharset = [
var DEFAULT_ICON_SIZE = 22; // px var DEFAULT_ICON_SIZE = 22; // px
var SUPPORTED_TYPES = ['Link', 'Text', 'Widget'];
/**
* @constructor
*/
function AnnotationFactory() {}
AnnotationFactory.prototype = {
/**
* @param {XRef} xref
* @param {Object} ref
* @returns {Annotation}
*/
create: function AnnotationFactory_create(xref, ref) {
var dict = xref.fetchIfRef(ref);
if (!isDict(dict)) {
return;
}
// Determine the annotation's subtype.
var subtype = dict.get('Subtype');
subtype = isName(subtype) ? subtype.name : '';
// Return the right annotation object based on the subtype and field type.
var parameters = {
dict: dict,
ref: ref
};
switch (subtype) {
case 'Link':
return new LinkAnnotation(parameters);
case 'Text':
return new TextAnnotation(parameters);
case 'Widget':
var fieldType = Util.getInheritableProperty(dict, 'FT');
if (isName(fieldType) && fieldType.name === 'Tx') {
return new TextWidgetAnnotation(parameters);
}
return new WidgetAnnotation(parameters);
default:
warn('Unimplemented annotation type "' + subtype + '", ' +
'falling back to base annotation');
return new Annotation(parameters);
}
}
};
var Annotation = (function AnnotationClosure() { var Annotation = (function AnnotationClosure() {
// 12.5.5: Algorithm: Appearance streams // 12.5.5: Algorithm: Appearance streams
@ -11474,13 +11523,9 @@ var Annotation = (function AnnotationClosure() {
isInvisible: function Annotation_isInvisible() { isInvisible: function Annotation_isInvisible() {
var data = this.data; var data = this.data;
if (data && SUPPORTED_TYPES.indexOf(data.subtype) !== -1) {
return false;
} else {
return !!(data && return !!(data &&
data.annotationFlags && // Default: not invisible data.annotationFlags && // Default: not invisible
data.annotationFlags & 0x1); // Invisible data.annotationFlags & 0x1); // Invisible
}
}, },
isViewable: function Annotation_isViewable() { isViewable: function Annotation_isViewable() {
@ -11556,70 +11601,6 @@ var Annotation = (function AnnotationClosure() {
} }
}; };
Annotation.getConstructor =
function Annotation_getConstructor(subtype, fieldType) {
if (!subtype) {
return;
}
// TODO(mack): Implement FreeText annotations
if (subtype === 'Link') {
return LinkAnnotation;
} else if (subtype === 'Text') {
return TextAnnotation;
} else if (subtype === 'Widget') {
if (!fieldType) {
return;
}
if (fieldType === 'Tx') {
return TextWidgetAnnotation;
} else {
return WidgetAnnotation;
}
} else {
return Annotation;
}
};
Annotation.fromRef = function Annotation_fromRef(xref, ref) {
var dict = xref.fetchIfRef(ref);
if (!isDict(dict)) {
return;
}
var subtype = dict.get('Subtype');
subtype = isName(subtype) ? subtype.name : '';
if (!subtype) {
return;
}
var fieldType = Util.getInheritableProperty(dict, 'FT');
fieldType = isName(fieldType) ? fieldType.name : '';
var Constructor = Annotation.getConstructor(subtype, fieldType);
if (!Constructor) {
return;
}
var params = {
dict: dict,
ref: ref,
};
var annotation = new Constructor(params);
if (annotation.isViewable() || annotation.isPrintable()) {
return annotation;
} else {
if (SUPPORTED_TYPES.indexOf(subtype) === -1) {
warn('unimplemented annotation type: ' + subtype);
}
}
};
Annotation.appendToOperatorList = function Annotation_appendToOperatorList( Annotation.appendToOperatorList = function Annotation_appendToOperatorList(
annotations, opList, pdfManager, partialEvaluator, intent) { annotations, opList, pdfManager, partialEvaluator, intent) {

4
build/pdf.js

@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {}; (typeof window !== 'undefined' ? window : this).PDFJS = {};
} }
PDFJS.version = '1.1.341'; PDFJS.version = '1.1.343';
PDFJS.build = 'd08895d'; PDFJS.build = 'e876dd8';
(function pdfjsWrapper() { (function pdfjsWrapper() {
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it

127
build/pdf.worker.js vendored

@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {}; (typeof window !== 'undefined' ? window : this).PDFJS = {};
} }
PDFJS.version = '1.1.341'; PDFJS.version = '1.1.343';
PDFJS.build = 'd08895d'; PDFJS.build = 'e876dd8';
(function pdfjsWrapper() { (function pdfjsWrapper() {
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it
@ -2820,10 +2820,12 @@ var Page = (function PageClosure() {
get annotations() { get annotations() {
var annotations = []; var annotations = [];
var annotationRefs = this.getInheritedPageProp('Annots') || []; var annotationRefs = this.getInheritedPageProp('Annots') || [];
var annotationFactory = new AnnotationFactory();
for (var i = 0, n = annotationRefs.length; i < n; ++i) { for (var i = 0, n = annotationRefs.length; i < n; ++i) {
var annotationRef = annotationRefs[i]; var annotationRef = annotationRefs[i];
var annotation = Annotation.fromRef(this.xref, annotationRef); var annotation = annotationFactory.create(this.xref, annotationRef);
if (annotation) { if (annotation &&
(annotation.isViewable() || annotation.isPrintable())) {
annotations.push(annotation); annotations.push(annotation);
} }
} }
@ -4902,7 +4904,54 @@ var ExpertSubsetCharset = [
var DEFAULT_ICON_SIZE = 22; // px var DEFAULT_ICON_SIZE = 22; // px
var SUPPORTED_TYPES = ['Link', 'Text', 'Widget'];
/**
* @constructor
*/
function AnnotationFactory() {}
AnnotationFactory.prototype = {
/**
* @param {XRef} xref
* @param {Object} ref
* @returns {Annotation}
*/
create: function AnnotationFactory_create(xref, ref) {
var dict = xref.fetchIfRef(ref);
if (!isDict(dict)) {
return;
}
// Determine the annotation's subtype.
var subtype = dict.get('Subtype');
subtype = isName(subtype) ? subtype.name : '';
// Return the right annotation object based on the subtype and field type.
var parameters = {
dict: dict,
ref: ref
};
switch (subtype) {
case 'Link':
return new LinkAnnotation(parameters);
case 'Text':
return new TextAnnotation(parameters);
case 'Widget':
var fieldType = Util.getInheritableProperty(dict, 'FT');
if (isName(fieldType) && fieldType.name === 'Tx') {
return new TextWidgetAnnotation(parameters);
}
return new WidgetAnnotation(parameters);
default:
warn('Unimplemented annotation type "' + subtype + '", ' +
'falling back to base annotation');
return new Annotation(parameters);
}
}
};
var Annotation = (function AnnotationClosure() { var Annotation = (function AnnotationClosure() {
// 12.5.5: Algorithm: Appearance streams // 12.5.5: Algorithm: Appearance streams
@ -5073,13 +5122,9 @@ var Annotation = (function AnnotationClosure() {
isInvisible: function Annotation_isInvisible() { isInvisible: function Annotation_isInvisible() {
var data = this.data; var data = this.data;
if (data && SUPPORTED_TYPES.indexOf(data.subtype) !== -1) {
return false;
} else {
return !!(data && return !!(data &&
data.annotationFlags && // Default: not invisible data.annotationFlags && // Default: not invisible
data.annotationFlags & 0x1); // Invisible data.annotationFlags & 0x1); // Invisible
}
}, },
isViewable: function Annotation_isViewable() { isViewable: function Annotation_isViewable() {
@ -5155,70 +5200,6 @@ var Annotation = (function AnnotationClosure() {
} }
}; };
Annotation.getConstructor =
function Annotation_getConstructor(subtype, fieldType) {
if (!subtype) {
return;
}
// TODO(mack): Implement FreeText annotations
if (subtype === 'Link') {
return LinkAnnotation;
} else if (subtype === 'Text') {
return TextAnnotation;
} else if (subtype === 'Widget') {
if (!fieldType) {
return;
}
if (fieldType === 'Tx') {
return TextWidgetAnnotation;
} else {
return WidgetAnnotation;
}
} else {
return Annotation;
}
};
Annotation.fromRef = function Annotation_fromRef(xref, ref) {
var dict = xref.fetchIfRef(ref);
if (!isDict(dict)) {
return;
}
var subtype = dict.get('Subtype');
subtype = isName(subtype) ? subtype.name : '';
if (!subtype) {
return;
}
var fieldType = Util.getInheritableProperty(dict, 'FT');
fieldType = isName(fieldType) ? fieldType.name : '';
var Constructor = Annotation.getConstructor(subtype, fieldType);
if (!Constructor) {
return;
}
var params = {
dict: dict,
ref: ref,
};
var annotation = new Constructor(params);
if (annotation.isViewable() || annotation.isPrintable()) {
return annotation;
} else {
if (SUPPORTED_TYPES.indexOf(subtype) === -1) {
warn('unimplemented annotation type: ' + subtype);
}
}
};
Annotation.appendToOperatorList = function Annotation_appendToOperatorList( Annotation.appendToOperatorList = function Annotation_appendToOperatorList(
annotations, opList, pdfManager, partialEvaluator, intent) { annotations, opList, pdfManager, partialEvaluator, intent) {

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "pdfjs-dist", "name": "pdfjs-dist",
"version": "1.1.341", "version": "1.1.343",
"description": "Generic build of Mozilla's PDF.js library.", "description": "Generic build of Mozilla's PDF.js library.",
"keywords": [ "keywords": [
"Mozilla", "Mozilla",

Loading…
Cancel
Save