Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
38fec85b70
@ -1196,20 +1196,20 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||||||
// Marked content
|
// Marked content
|
||||||
|
|
||||||
markPoint: function CanvasGraphics_markPoint(tag) {
|
markPoint: function CanvasGraphics_markPoint(tag) {
|
||||||
TODO('Marked content');
|
// TODO Marked content.
|
||||||
},
|
},
|
||||||
markPointProps: function CanvasGraphics_markPointProps(tag, properties) {
|
markPointProps: function CanvasGraphics_markPointProps(tag, properties) {
|
||||||
TODO('Marked content');
|
// TODO Marked content.
|
||||||
},
|
},
|
||||||
beginMarkedContent: function CanvasGraphics_beginMarkedContent(tag) {
|
beginMarkedContent: function CanvasGraphics_beginMarkedContent(tag) {
|
||||||
TODO('Marked content');
|
// TODO Marked content.
|
||||||
},
|
},
|
||||||
beginMarkedContentProps: function CanvasGraphics_beginMarkedContentProps(
|
beginMarkedContentProps: function CanvasGraphics_beginMarkedContentProps(
|
||||||
tag, properties) {
|
tag, properties) {
|
||||||
TODO('Marked content');
|
// TODO Marked content.
|
||||||
},
|
},
|
||||||
endMarkedContent: function CanvasGraphics_endMarkedContent() {
|
endMarkedContent: function CanvasGraphics_endMarkedContent() {
|
||||||
TODO('Marked content');
|
// TODO Marked content.
|
||||||
},
|
},
|
||||||
|
|
||||||
// Compatibility
|
// Compatibility
|
||||||
|
15
src/core.js
15
src/core.js
@ -52,8 +52,16 @@ function getPdf(arg, callback) {
|
|||||||
if ('progress' in params)
|
if ('progress' in params)
|
||||||
xhr.onprogress = params.progress || undefined;
|
xhr.onprogress = params.progress || undefined;
|
||||||
|
|
||||||
if ('error' in params)
|
var calledErrorBack = false;
|
||||||
xhr.onerror = params.error || undefined;
|
|
||||||
|
if ('error' in params) {
|
||||||
|
xhr.onerror = function errorBack() {
|
||||||
|
if (!calledErrorBack) {
|
||||||
|
calledErrorBack = true;
|
||||||
|
params.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
xhr.onreadystatechange = function getPdfOnreadystatechange(e) {
|
xhr.onreadystatechange = function getPdfOnreadystatechange(e) {
|
||||||
if (xhr.readyState === 4) {
|
if (xhr.readyState === 4) {
|
||||||
@ -61,7 +69,8 @@ function getPdf(arg, callback) {
|
|||||||
var data = (xhr.mozResponseArrayBuffer || xhr.mozResponse ||
|
var data = (xhr.mozResponseArrayBuffer || xhr.mozResponse ||
|
||||||
xhr.responseArrayBuffer || xhr.response);
|
xhr.responseArrayBuffer || xhr.response);
|
||||||
callback(data);
|
callback(data);
|
||||||
} else if (params.error) {
|
} else if (params.error && !calledErrorBack) {
|
||||||
|
calledErrorBack = true;
|
||||||
params.error(e);
|
params.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
73
src/fonts.js
73
src/fonts.js
@ -3391,8 +3391,8 @@ var Type1Parser = function type1Parser() {
|
|||||||
'1': 'vstem',
|
'1': 'vstem',
|
||||||
'2': 'hstem',
|
'2': 'hstem',
|
||||||
|
|
||||||
|
'6': 'endchar', // seac
|
||||||
// Type1 only command with command not (yet) built-in ,throw an error
|
// Type1 only command with command not (yet) built-in ,throw an error
|
||||||
'6': -1, // seac
|
|
||||||
'7': -1, // sbw
|
'7': -1, // sbw
|
||||||
|
|
||||||
'11': 'sub',
|
'11': 'sub',
|
||||||
@ -3422,6 +3422,43 @@ var Type1Parser = function type1Parser() {
|
|||||||
|
|
||||||
var kEscapeCommand = 12;
|
var kEscapeCommand = 12;
|
||||||
|
|
||||||
|
// Breaks up the stack by arguments and also calculates the value.
|
||||||
|
function breakUpArgs(stack, numArgs) {
|
||||||
|
var args = [];
|
||||||
|
var index = stack.length - 1;
|
||||||
|
for (var i = 0; i < numArgs; i++) {
|
||||||
|
if (index < 0) {
|
||||||
|
args.unshift({ arg: [0],
|
||||||
|
value: 0,
|
||||||
|
offset: 0 });
|
||||||
|
warn('Malformed charstring stack: not enough values on stack.');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var token = stack[index];
|
||||||
|
if (token === 'div') {
|
||||||
|
var a = stack[index - 2];
|
||||||
|
var b = stack[index - 1];
|
||||||
|
if (!isInt(a) || !isInt(b)) {
|
||||||
|
warn('Malformed charsting stack: expected ints on stack for div.');
|
||||||
|
a = 0;
|
||||||
|
b = 1;
|
||||||
|
}
|
||||||
|
args.unshift({ arg: [a, b, 'div'],
|
||||||
|
value: a / b,
|
||||||
|
offset: index - 2 });
|
||||||
|
index -= 3;
|
||||||
|
} else if (isInt(token)) {
|
||||||
|
args.unshift({ arg: stack.slice(index, index + 1),
|
||||||
|
value: token,
|
||||||
|
offset: index });
|
||||||
|
index--;
|
||||||
|
} else {
|
||||||
|
warn('Malformed charsting stack: found bad token ' + token + '.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
function decodeCharString(array) {
|
function decodeCharString(array) {
|
||||||
var charstring = [];
|
var charstring = [];
|
||||||
var lsb = 0;
|
var lsb = 0;
|
||||||
@ -3464,6 +3501,12 @@ var Type1Parser = function type1Parser() {
|
|||||||
// pop or setcurrentpoint commands can be ignored
|
// pop or setcurrentpoint commands can be ignored
|
||||||
// since we are not doing callothersubr
|
// since we are not doing callothersubr
|
||||||
continue;
|
continue;
|
||||||
|
} else if (escape == 6) {
|
||||||
|
// seac is like type 2's special endchar but it doesn't use the
|
||||||
|
// first argument asb, so remove it.
|
||||||
|
var args = breakUpArgs(charstring, 5);
|
||||||
|
var arg0 = args[0];
|
||||||
|
charstring.splice(arg0.offset, arg0.arg.length);
|
||||||
} else if (!kHintingEnabled && (escape == 1 || escape == 2)) {
|
} else if (!kHintingEnabled && (escape == 1 || escape == 2)) {
|
||||||
charstring.push('drop', 'drop', 'drop', 'drop', 'drop', 'drop');
|
charstring.push('drop', 'drop', 'drop', 'drop', 'drop', 'drop');
|
||||||
continue;
|
continue;
|
||||||
@ -3471,25 +3514,17 @@ var Type1Parser = function type1Parser() {
|
|||||||
|
|
||||||
command = charStringDictionary['12'][escape];
|
command = charStringDictionary['12'][escape];
|
||||||
} else {
|
} else {
|
||||||
// TODO Clean this code
|
|
||||||
if (value == 13) { // hsbw
|
if (value == 13) { // hsbw
|
||||||
if (charstring.length == 2) {
|
var args = breakUpArgs(charstring, 2);
|
||||||
lsb = charstring[0];
|
var arg0 = args[0];
|
||||||
width = charstring[1];
|
var arg1 = args[1];
|
||||||
charstring.splice(0, 1);
|
lsb = arg0.value;
|
||||||
} else if (charstring.length == 4 && charstring[3] == 'div') {
|
width = arg1.value;
|
||||||
lsb = charstring[0];
|
// To convert to type2 we have to move the width value to the first
|
||||||
width = charstring[1] / charstring[2];
|
// part of the charstring and then use hmoveto with lsb.
|
||||||
charstring.splice(0, 1);
|
charstring = arg1.arg;
|
||||||
} else if (charstring.length == 4 && charstring[2] == 'div') {
|
charstring = charstring.concat(arg0.arg);
|
||||||
lsb = charstring[0] / charstring[1];
|
charstring.push('hmoveto');
|
||||||
width = charstring[3];
|
|
||||||
charstring.splice(0, 3);
|
|
||||||
} else {
|
|
||||||
error('Unsupported hsbw format: ' + charstring);
|
|
||||||
}
|
|
||||||
|
|
||||||
charstring.push(lsb, 'hmoveto');
|
|
||||||
continue;
|
continue;
|
||||||
} else if (value == 10) { // callsubr
|
} else if (value == 10) { // callsubr
|
||||||
if (charstring[charstring.length - 1] < 3) { // subr #0..2
|
if (charstring[charstring.length - 1] < 3) { // subr #0..2
|
||||||
|
1
test/pdfs/issue818.pdf.link
Normal file
1
test/pdfs/issue818.pdf.link
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://www.effi.org/system/files?file=effi-siv-251110.pdf
|
@ -633,5 +633,13 @@
|
|||||||
"pageLimit": 2,
|
"pageLimit": 2,
|
||||||
"link": true,
|
"link": true,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
|
},
|
||||||
|
{ "id": "issue818",
|
||||||
|
"file": "pdfs/issue818.pdf",
|
||||||
|
"md5": "dd2f8a5bd65164ad74da2b45a6ca90cc",
|
||||||
|
"rounds": 1,
|
||||||
|
"pageLimit": 1,
|
||||||
|
"link": true,
|
||||||
|
"type": "eq"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user