: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
marginV = this.margin.topInset + this.margin.bottomInset;
if (this.w === "" || this.h === "") {
if (this.ui.checkButton) {
uiW = uiH = this.ui.checkButton.size;
} = layoutNode(this, availableSpace);
uiH = fonts_getMetrics(this.font, true).lineNoGap;
borderDims = getBorderDims(this.ui[$getExtra]());
} = this.caption[$getExtra](availableSpace);
if (isBroken && this[$getSubformParent]()[$isThereMoreWidth]()) {
return HTMLResult.FAILURE;
switch (this.caption.placement) {
if (width && this.w === "") {
this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
if (height && this.h === "") {
this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
setFirstUnsplittable(this);
if (!checkDimensions(this, availableSpace)) {
return HTMLResult.FAILURE;
unsetFirstUnsplittable(this);
const style = toStyle(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
setMinMaxDimensions(this, style);
const classNames = ["xfaField"];
classNames.push("xfaFont");
classNames.push("xfaPrintOnly");
style.padding = style.margin;
setAccess(this, classNames);
attributes.xfaName = this.name;
applyAssist(this, attributes);
const borderStyle = this.border ? this.border[$toStyle]() : null;
const bbox = computeBbox(this, html, availableSpace);
const ui = this.ui[$toHTML]().html;
Object.assign(style, borderStyle);
return HTMLResult.success(createWrapper(this, html), bbox);
ui.children[0].attributes.tabindex = this[$tabIndex];
ui.attributes.tabindex = this[$tabIndex];
if (!ui.attributes.style) {
ui.attributes.style = Object.create(null);
if (ui.children.length === 1) {
[aElement] = ui.children.splice(0, 1);
Object.assign(ui.attributes.style, borderStyle);
Object.assign(style, borderStyle);
ui.children.push(this.value[$toHTML]().html);
} else if (!this.ui.button) {
value = this.value.exData[$text]();
} else if (this.value.text) {
value = this.value.text[$getExtra]();
const htmlValue = this.value[$toHTML]().html;
if (htmlValue !== null) {
value = htmlValue.children[0].value;
if (this.ui.textEdit && this.value.text?.maxChars) {
ui.children[0].attributes.maxLength = this.value.text.maxChars;
if (this.ui.numericEdit) {
value = parseFloat(value);
value = isNaN(value) ? "" : value.toString();
if (ui.children[0].name === "textarea") {
ui.children[0].attributes.textContent = value;
ui.children[0].attributes.value = value;
if (!this.ui.imageEdit && ui.children?.[0] && this.h) {
borderDims = borderDims || getBorderDims(this.ui[$getExtra]());
if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
captionHeight = this.caption.reserve;
if (captionHeight <= 0) {
captionHeight = this.caption[$getExtra](availableSpace).h;
const inputHeight = this.h - captionHeight - marginV - borderDims.h;
ui.children[0].attributes.style.height = measureToString(inputHeight);
ui.children[0].attributes.style.height = "100%";
ui.children.push(aElement);
if (ui.attributes.class) {
ui.attributes.class.push("xfaLeft");
return HTMLResult.success(createWrapper(this, html), bbox);
if (caption.name === "div") {
ui.children.push(caption);
return HTMLResult.success(html, bbox);
} else if (this.ui.checkButton) {
caption.attributes.class[0] = "xfaCaptionForCheckButton";
if (!ui.attributes.class) {
ui.attributes.class = [];
ui.children.splice(0, 0, caption);
switch (this.caption.placement) {
ui.attributes.class.push("xfaLeft");
ui.attributes.class.push("xfaRight");
ui.attributes.class.push("xfaTop");
ui.attributes.class.push("xfaBottom");
ui.attributes.class.push("xfaLeft");
return HTMLResult.success(createWrapper(this, html), bbox);
class Fill extends XFAObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "fill", true);
this.id = attributes.id || "";
this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
this.use = attributes.use || "";
this.usehref = attributes.usehref || "";
const parent = this[$getParent]();
const grandpa = parent[$getParent]();
const ggrandpa = grandpa[$getParent]();
const style = Object.create(null);
let altPropName = propName;
if (parent instanceof Border) {
propName = "background-color";
altPropName = "background";
if (ggrandpa instanceof Ui) {
style.backgroundColor = "white";
if (parent instanceof Rectangle || parent instanceof Arc) {
propName = altPropName = "fill";
for (const name of Object.getOwnPropertyNames(this)) {
if (name === "extras" || name === "color") {
if (!(obj instanceof XFAObject)) {
const color = obj[$toStyle](this.color);
style[color.startsWith("#") ? propName : altPropName] = color;
const color = this.color[$toStyle]();
style[color.startsWith("#") ? propName : altPropName] = color;
class Filter extends XFAObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "filter", true);
this.addRevocationInfo = getStringOption(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
this.id = attributes.id || "";
this.name = attributes.name || "";
this.use = attributes.use || "";
this.usehref = attributes.usehref || "";
this.version = getInteger({
validate: x => x >= 1 && x <= 5
this.appearanceFilter = null;
this.certificates = null;
this.digestMethods = null;
this.encryptionMethods = null;
this.lockDocument = null;
class Float extends ContentObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "float");
this.id = attributes.id || "";
this.name = attributes.name || "";
this.use = attributes.use || "";
this.usehref = attributes.usehref || "";
const number = parseFloat(this[$content].trim());
this[$content] = isNaN(number) ? null : number;
[$toHTML](availableSpace) {
return valueToHtml(this[$content] !== null ? this[$content].toString() : "");
class template_Font extends XFAObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "font", true);
this.baselineShift = getMeasurement(attributes.baselineShift);
this.fontHorizontalScale = getFloat({
data: attributes.fontHorizontalScale,
this.fontVerticalScale = getFloat({
data: attributes.fontVerticalScale,
this.id = attributes.id || "";
this.kerningMode = getStringOption(attributes.kerningMode, ["none", "pair"]);
this.letterSpacing = getMeasurement(attributes.letterSpacing, "0");
this.lineThrough = getInteger({
data: attributes.lineThrough,
validate: x => x === 1 || x === 2
this.lineThroughPeriod = getStringOption(attributes.lineThroughPeriod, ["all", "word"]);
this.overline = getInteger({
data: attributes.overline,
validate: x => x === 1 || x === 2
this.overlinePeriod = getStringOption(attributes.overlinePeriod, ["all", "word"]);
this.posture = getStringOption(attributes.posture, ["normal", "italic"]);
this.size = getMeasurement(attributes.size, "10pt");
this.typeface = attributes.typeface || "Courier";
this.underline = getInteger({
data: attributes.underline,
validate: x => x === 1 || x === 2
this.underlinePeriod = getStringOption(attributes.underlinePeriod, ["all", "word"]);
this.use = attributes.use || "";
this.usehref = attributes.usehref || "";
this.weight = getStringOption(attributes.weight, ["normal", "bold"]);
this[$globalData].usedTypefaces.add(this.typeface);
const style = toStyle(this, "fill");
const color = style.color;
if (color === "#000000") {
} else if (!color.startsWith("#")) {
style.background = color;
style.backgroundClip = "text";
style.color = "transparent";
if (this.baselineShift) {
style.verticalAlign = measureToString(this.baselineShift);
style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
style.letterSpacing = measureToString(this.letterSpacing);
if (this.lineThrough !== 0) {
style.textDecoration = "line-through";
if (this.lineThrough === 2) {
style.textDecorationStyle = "double";
if (this.overline !== 0) {
style.textDecoration = "overline";
if (this.overline === 2) {
style.textDecorationStyle = "double";
style.fontStyle = this.posture;
style.fontSize = measureToString(0.99 * this.size);
setFontFamily(this, this, this[$globalData].fontFinder, style);
if (this.underline !== 0) {
style.textDecoration = "underline";
if (this.underline === 2) {
style.textDecorationStyle = "double";
style.fontWeight = this.weight;
class Format extends XFAObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "format", true);
this.id = attributes.id || "";
this.use = attributes.use || "";
this.usehref = attributes.usehref || "";
class Handler extends StringObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "handler");
this.id = attributes.id || "";
this.type = getStringOption(attributes.type, ["optional", "required"]);
this.use = attributes.use || "";
this.usehref = attributes.usehref || "";
class Hyphenation extends XFAObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "hyphenation");
this.excludeAllCaps = getInteger({
data: attributes.excludeAllCaps,
this.excludeInitialCap = getInteger({
data: attributes.excludeInitialCap,
this.hyphenate = getInteger({
data: attributes.hyphenate,
this.id = attributes.id || "";
this.pushCharacterCount = getInteger({
data: attributes.pushCharacterCount,
this.remainCharacterCount = getInteger({
data: attributes.remainCharacterCount,
this.use = attributes.use || "";
this.usehref = attributes.usehref || "";
this.wordCharacterCount = getInteger({
data: attributes.wordCharacterCount,
class Image extends StringObject {
constructor(attributes) {
super(TEMPLATE_NS_ID, "image");
this.aspect = getStringOption(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
this.contentType = attributes.contentType || "";
this.href = attributes.href || "";
this.id = attributes.id || "";
this.name = attributes.name || "";
this.transferEncoding = getStringOption(attributes.transferEncoding, ["base64", "none", "package"]);
this.use = attributes.use || "";
this.usehref = attributes.usehref || "";
if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
let buffer = this[$globalData].images && this[$globalData].images.get(this.href);
if (!buffer && (this.href || !this[$content])) {
if (!buffer && this.transferEncoding === "base64") {
buffer = stringToBytes(atob(this[$content]));
for (const [header, type] of IMAGES_HEADERS) {
if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {