mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Handle nested post script arguments in the preprocessor
Fix for issue #4785
This commit is contained in:
parent
6d330250da
commit
3e7bcaa892
2 changed files with 30 additions and 4 deletions
|
@ -1846,6 +1846,7 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() {
|
|||
// dictionary
|
||||
this.parser = new Parser(new Lexer(stream, OP_MAP), false, xref);
|
||||
this.stateManager = stateManager;
|
||||
this.nonProcessedArgs = [];
|
||||
}
|
||||
|
||||
EvaluatorPreprocessor.prototype = {
|
||||
|
@ -1879,6 +1880,17 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() {
|
|||
|
||||
var fn = opSpec.id;
|
||||
|
||||
// Some post script commands can be nested, e.g. /F2 /GS2 gs 5.711 Tf
|
||||
if (!opSpec.variableArgs && args.length !== opSpec.numArgs) {
|
||||
while (args.length > opSpec.numArgs) {
|
||||
this.nonProcessedArgs.push(args.shift());
|
||||
}
|
||||
|
||||
while (args.length < opSpec.numArgs && this.nonProcessedArgs.length) {
|
||||
args.unshift(this.nonProcessedArgs.pop());
|
||||
}
|
||||
}
|
||||
|
||||
// Validate the number of arguments for the command
|
||||
if (opSpec.variableArgs) {
|
||||
if (args.length > opSpec.numArgs) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue