: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
const parent = this[$getParent]();
if (parent.relation === "orderedOccurrence") {
this[$extra].numberOfUse += 1;
return parent[$getNextPage]();
return this[$extra].space || {
this[$extra].children = children;
const style = Object.create(null);
if (this.medium && this.medium.short && this.medium.long) {
style.width = measureToString(this.medium.short);
style.height = measureToString(this.medium.long);
width: this.medium.short,
if (this.medium.orientation === "landscape") {
style.width = style.height;
height: this.medium.short
warn("XFA - No medium specified in pageArea: please file a bug.");
filter: new Set(["area", "draw", "field", "subform"]),
filter: new Set(["contentArea"]),
return HTMLResult.success({
class PageSet extends XFAObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "pageSet", true);
this.duplexImposition = getStringOption(attributes.duplexImposition, ["longEdge", "shortEdge"]);
this.id = attributes.id || "";
this.name = attributes.name || "";
this.relation = getStringOption(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
this.relevant = getRelevant(attributes.relevant);
this.use = attributes.use || "";
this.usehref = attributes.usehref || "";
this.pageArea = new XFAObjectArray();
this.pageSet = new XFAObjectArray();
for (const page of this.pageArea.children) {
for (const page of this.pageSet.children) {
return !this.occur || this.occur.max === -1 || this[$extra].numberOfUse < this.occur.max;
if (this.relation === "orderedOccurrence") {
if (this[$extra].pageIndex + 1 < this.pageArea.children.length) {
this[$extra].pageIndex += 1;
const pageArea = this.pageArea.children[this[$extra].pageIndex];
return pageArea[$getNextPage]();
if (this[$extra].pageSetIndex + 1 < this.pageSet.children.length) {
this[$extra].pageSetIndex += 1;
return this.pageSet.children[this[$extra].pageSetIndex][$getNextPage]();
this[$extra].numberOfUse += 1;
this[$extra].pageIndex = -1;
this[$extra].pageSetIndex = -1;
return this[$getNextPage]();
const parent = this[$getParent]();
if (parent instanceof PageSet) {
return parent[$getNextPage]();
return this[$getNextPage]();
const pageNumber = this[$getTemplateRoot]()[$extra].pageNumber;
const parity = pageNumber % 2 === 0 ? "even" : "odd";
const position = pageNumber === 0 ? "first" : "rest";
let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
return this.pageArea.children[0];
class Para extends XFAObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "para", true);
this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
this.id = attributes.id || "";
this.lineHeight = attributes.lineHeight ? getMeasurement(attributes.lineHeight, "0pt") : "";
this.marginLeft = attributes.marginLeft ? getMeasurement(attributes.marginLeft, "0pt") : "";
this.marginRight = attributes.marginRight ? getMeasurement(attributes.marginRight, "0pt") : "";
this.orphans = getInteger({
data: attributes.orphans,
this.preserve = attributes.preserve || "";
this.radixOffset = attributes.radixOffset ? getMeasurement(attributes.radixOffset, "0pt") : "";
this.spaceAbove = attributes.spaceAbove ? getMeasurement(attributes.spaceAbove, "0pt") : "";
this.spaceBelow = attributes.spaceBelow ? getMeasurement(attributes.spaceBelow, "0pt") : "";
this.tabDefault = attributes.tabDefault ? getMeasurement(this.tabDefault) : "";
this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? getMeasurement(x) : x);
this.textIndent = attributes.textIndent ? getMeasurement(attributes.textIndent, "0pt") : "";
this.use = attributes.use || "";
this.usehref = attributes.usehref || "";
this.vAlign = getStringOption(attributes.vAlign, ["top", "bottom", "middle"]);
this.widows = getInteger({
const style = toStyle(this, "hAlign");
if (this.marginLeft !== "") {
style.paddingLeft = measureToString(this.marginLeft);
if (this.marginRight !== "") {
style.paddingight = measureToString(this.marginRight);
if (this.spaceAbove !== "") {
style.paddingTop = measureToString(this.spaceAbove);
if (this.spaceBelow !== "") {
style.paddingBottom = measureToString(this.spaceBelow);
if (this.textIndent !== "") {
style.textIndent = measureToString(this.textIndent);
if (this.lineHeight > 0) {
style.lineHeight = measureToString(this.lineHeight);
if (this.tabDefault !== "") {
style.tabSize = measureToString(this.tabDefault);
if (this.tabStops.length > 0) {}
if (this.hyphenatation) {
Object.assign(style, this.hyphenatation[$toStyle]());
class PasswordEdit extends XFAObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "passwordEdit", true);
this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, ["auto", "off", "on"]);
this.id = attributes.id || "";
this.passwordChar = attributes.passwordChar || "*";
this.use = attributes.use || "";
this.usehref = attributes.usehref || "";
class template_Pattern extends XFAObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "pattern", true);
this.id = attributes.id || "";
this.type = getStringOption(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
this.use = attributes.use || "";
this.usehref = attributes.usehref || "";
startColor = startColor ? startColor[$toStyle]() : "#FFFFFF";
const endColor = this.color ? this.color[$toStyle]() : "#000000";
const cmd = "repeating-linear-gradient";
const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
return `${cmd}(45deg,${colors})`;
return `${cmd}(-45deg,${colors})`;
return `${cmd}(to top,${colors})`;
return `${cmd}(to right,${colors})`;
class Picture extends StringObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "picture");
this.id = attributes.id || "";
this.use = attributes.use || "";
this.usehref = attributes.usehref || "";
class Proto extends XFAObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "proto", true);
this.appearanceFilter = new XFAObjectArray();
this.arc = new XFAObjectArray();
this.area = new XFAObjectArray();
this.assist = new XFAObjectArray();
this.barcode = new XFAObjectArray();
this.bindItems = new XFAObjectArray();
this.bookend = new XFAObjectArray();
this.boolean = new XFAObjectArray();
this.border = new XFAObjectArray();
this.break = new XFAObjectArray();
this.breakAfter = new XFAObjectArray();
this.breakBefore = new XFAObjectArray();
this.button = new XFAObjectArray();
this.calculate = new XFAObjectArray();
this.caption = new XFAObjectArray();
this.certificate = new XFAObjectArray();
this.certificates = new XFAObjectArray();
this.checkButton = new XFAObjectArray();
this.choiceList = new XFAObjectArray();
this.color = new XFAObjectArray();
this.comb = new XFAObjectArray();
this.connect = new XFAObjectArray();
this.contentArea = new XFAObjectArray();
this.corner = new XFAObjectArray();
this.date = new XFAObjectArray();
this.dateTime = new XFAObjectArray();
this.dateTimeEdit = new XFAObjectArray();
this.decimal = new XFAObjectArray();
this.defaultUi = new XFAObjectArray();
this.desc = new XFAObjectArray();
this.digestMethod = new XFAObjectArray();
this.digestMethods = new XFAObjectArray();
this.draw = new XFAObjectArray();
this.edge = new XFAObjectArray();
this.encoding = new XFAObjectArray();
this.encodings = new XFAObjectArray();
this.encrypt = new XFAObjectArray();
this.encryptData = new XFAObjectArray();
this.encryption = new XFAObjectArray();
this.encryptionMethod = new XFAObjectArray();
this.encryptionMethods = new XFAObjectArray();
this.event = new XFAObjectArray();
this.exData = new XFAObjectArray();
this.exObject = new XFAObjectArray();
this.exclGroup = new XFAObjectArray();
this.execute = new XFAObjectArray();
this.extras = new XFAObjectArray();
this.field = new XFAObjectArray();
this.fill = new XFAObjectArray();
this.filter = new XFAObjectArray();
this.float = new XFAObjectArray();
this.font = new XFAObjectArray();
this.format = new XFAObjectArray();
this.handler = new XFAObjectArray();
this.hyphenation = new XFAObjectArray();
this.image = new XFAObjectArray();
this.imageEdit = new XFAObjectArray();
this.integer = new XFAObjectArray();
this.issuers = new XFAObjectArray();
this.items = new XFAObjectArray();
this.keep = new XFAObjectArray();
this.keyUsage = new XFAObjectArray();
this.line = new XFAObjectArray();
this.linear = new XFAObjectArray();
this.lockDocument = new XFAObjectArray();
this.manifest = new XFAObjectArray();
this.margin = new XFAObjectArray();
this.mdp = new XFAObjectArray();
this.medium = new XFAObjectArray();
this.message = new XFAObjectArray();
this.numericEdit = new XFAObjectArray();
this.occur = new XFAObjectArray();
this.oid = new XFAObjectArray();
this.oids = new XFAObjectArray();
this.overflow = new XFAObjectArray();
this.pageArea = new XFAObjectArray();
this.pageSet = new XFAObjectArray();
this.para = new XFAObjectArray();
this.passwordEdit = new XFAObjectArray();
this.pattern = new XFAObjectArray();
this.picture = new XFAObjectArray();
this.radial = new XFAObjectArray();
this.reason = new XFAObjectArray();
this.reasons = new XFAObjectArray();
this.rectangle = new XFAObjectArray();
this.ref = new XFAObjectArray();
this.script = new XFAObjectArray();
this.setProperty = new XFAObjectArray();
this.signData = new XFAObjectArray();
this.signature = new XFAObjectArray();
this.signing = new XFAObjectArray();
this.solid = new XFAObjectArray();
this.speak = new XFAObjectArray();
this.stipple = new XFAObjectArray();
this.subform = new XFAObjectArray();
this.subformSet = new XFAObjectArray();
this.subjectDN = new XFAObjectArray();
this.subjectDNs = new XFAObjectArray();
this.submit = new XFAObjectArray();
this.text = new XFAObjectArray();
this.textEdit = new XFAObjectArray();
this.time = new XFAObjectArray();
this.timeStamp = new XFAObjectArray();
this.toolTip = new XFAObjectArray();
this.traversal = new XFAObjectArray();
this.traverse = new XFAObjectArray();
this.ui = new XFAObjectArray();
this.validate = new XFAObjectArray();
this.value = new XFAObjectArray();
this.variables = new XFAObjectArray();
class Radial extends XFAObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "radial", true);
this.id = attributes.id || "";
this.type = getStringOption(attributes.type, ["toEdge", "toCenter"]);
this.use = attributes.use || "";
this.usehref = attributes.usehref || "";
startColor = startColor ? startColor[$toStyle]() : "#FFFFFF";
const endColor = this.color ? this.color[$toStyle]() : "#000000";
const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
return `radial-gradient(circle at center, ${colors})`;
class Reason extends StringObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "reason");
this.id = attributes.id || "";
this.name = attributes.name || "";
this.use = attributes.use || "";
this.usehref = attributes.usehref || "";
class Reasons extends XFAObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "reasons", true);
this.id = attributes.id || "";
this.type = getStringOption(attributes.type, ["optional", "required"]);
this.use = attributes.use || "";
this.usehref = attributes.usehref || "";
this.reason = new XFAObjectArray();
class Rectangle extends XFAObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "rectangle", true);
this.hand = getStringOption(attributes.hand, ["even", "left", "right"]);
this.id = attributes.id || "";
this.use = attributes.use || "";
this.usehref = attributes.usehref || "";
this.corner = new XFAObjectArray(4);
this.edge = new XFAObjectArray(4);
const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
const edgeStyle = edge[$toStyle]();
const style = Object.create(null);
if (this.fill?.presence === "visible") {
Object.assign(style, this.fill[$toStyle]());
style.fill = "transparent";
style.strokeWidth = measureToString(edge.presence === "visible" ? edge.thickness : 0);
style.stroke = edgeStyle.color;
const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
const cornerStyle = corner[$toStyle]();
const parent = this[$getParent]()[$getParent]();
return HTMLResult.success({
svg.attributes.style.position = "absolute";
return HTMLResult.success(svg);
class RefElement extends StringObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "ref");
this.id = attributes.id || "";
this.use = attributes.use || "";
this.usehref = attributes.usehref || "";
class Script extends StringObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "script");
this.binding = attributes.binding || "";
this.contentType = attributes.contentType || "";
this.id = attributes.id || "";
this.name = attributes.name || "";
this.runAt = getStringOption(attributes.runAt, ["client", "both", "server"]);
this.use = attributes.use || "";
this.usehref = attributes.usehref || "";
class SetProperty extends XFAObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "setProperty");
this.connection = attributes.connection || "";
this.ref = attributes.ref || "";
this.target = attributes.target || "";