: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
id: OPS.closeEOFillStroke,
id: OPS.setTextRenderingMode,
id: OPS.setLeadingMoveText,
id: OPS.nextLineShowText,
id: OPS.nextLineSetSpacingShowText,
id: OPS.setCharWidthAndBounds,
id: OPS.setStrokeColorSpace,
id: OPS.setFillColorSpace,
id: OPS.setStrokeRGBColor,
id: OPS.setStrokeCMYKColor,
id: OPS.setFillCMYKColor,
id: OPS.beginInlineImage,
id: OPS.beginMarkedContent,
id: OPS.beginMarkedContentProps,
id: OPS.endMarkedContent,
static MAX_INVALID_PATH_OPS = 10;
constructor(stream, xref, stateManager = new StateManager()) {
this.parser = new Parser({
lexer: new Lexer(stream, EvaluatorPreprocessor.opMap),
this.stateManager = stateManager;
this.nonProcessedArgs = [];
this._numInvalidPathOPS = 0;
return this.stateManager.stateStack.length;
let args = operation.args;
const obj = this.parser.getObj();
if (obj instanceof Cmd) {
const opSpec = EvaluatorPreprocessor.opMap[cmd];
warn(`Unknown command "${cmd}".`);
const numArgs = opSpec.numArgs;
let argsLength = args !== null ? args.length : 0;
this._numInvalidPathOPS = 0;
this._isPathOp = fn >= OPS.moveTo && fn <= OPS.endPath;
if (!opSpec.variableArgs) {
if (argsLength !== numArgs) {
const nonProcessedArgs = this.nonProcessedArgs;
while (argsLength > numArgs) {
nonProcessedArgs.push(args.shift());
while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
args.unshift(nonProcessedArgs.pop());
if (argsLength < numArgs) {
const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
if (this._isPathOp && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
throw new FormatError(`Invalid ${partialMsg}`);
warn(`Skipping ${partialMsg}`);
} else if (argsLength > numArgs) {
info(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
this.preprocessCommand(fn, args);
throw new FormatError("Too many arguments");
preprocessCommand(fn, args) {
this.stateManager.save();
this.stateManager.restore();
this.stateManager.transform(args);
;// CONCATENATED MODULE: ./src/core/default_appearance.js
class DefaultAppearanceEvaluator extends EvaluatorPreprocessor {
super(new StringStream(str));
fontColor: new Uint8ClampedArray(3)
operation.args.length = 0;
if (!this.read(operation)) {
if (this.savedStatesDepth !== 0) {
const [fontName, fontSize] = args;
if (fontName instanceof Name) {
result.fontName = fontName.name;
if (typeof fontSize === "number" && fontSize > 0) {
result.fontSize = fontSize;
case OPS.setFillRGBColor:
ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
case OPS.setFillCMYKColor:
ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
warn(`parseDefaultAppearance - ignoring errors: "${reason}".`);
function parseDefaultAppearance(str) {
return new DefaultAppearanceEvaluator(str).parse();
class AppearanceStreamEvaluator extends EvaluatorPreprocessor {
constructor(stream, evaluatorOptions, xref) {
this.evaluatorOptions = evaluatorOptions;
this.resources = stream.dict?.get("Resources");
fontColor: new Uint8ClampedArray(3),
fillColorSpace: ColorSpace.singletons.gray
operation.args.length = 0;
if (breakLoop || !this.read(operation)) {
scaleFactor: result.scaleFactor,
fontSize: result.fontSize,
fontName: result.fontName,
fontColor: result.fontColor.slice(),
fillColorSpace: result.fillColorSpace
result = stack.pop() || result;
result.scaleFactor *= Math.hypot(args[0], args[1]);
const [fontName, fontSize] = args;
if (fontName instanceof Name) {
result.fontName = fontName.name;
if (typeof fontSize === "number" && fontSize > 0) {
result.fontSize = fontSize * result.scaleFactor;
case OPS.setFillColorSpace: