: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
html.attributes.style.height = measureToString(height);
bbox = [node.x, node.y, width, height];
function fixDimensions(node) {
const parent = node[$getSubformParent]();
if (parent.layout?.includes("row")) {
const extra = parent[$extra];
const colSpan = node.colSpan;
width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
if (parent.layout && parent.layout !== "position") {
if (node.layout === "table") {
if (node.w === "" && Array.isArray(node.columnWidths)) {
node.w = node.columnWidths.reduce((a, x) => a + x, 0);
function layoutClass(node) {
function toStyle(node, ...names) {
const style = Object.create(null);
for (const name of names) {
const value = node[name];
if (converters.hasOwnProperty(name)) {
converters[name](node, style);
if (value instanceof XFAObject) {
const newStyle = value[$toStyle]();
Object.assign(style, newStyle);
warn(`(DEBUG) - XFA - style for ${name} not implemented yet`);
function createWrapper(node, html) {
style: Object.create(null)
attributes.class.push("xfaWrapped");
const insetsH = insets[0] + insets[2];
const insetsW = insets[1] + insets[3];
switch (node.border.hand) {
width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
const classNames = ["xfaBorder"];
if (isPrintOnly(node.border)) {
classNames.push("xfaPrintOnly");
for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
if (style[key] !== undefined) {
border.attributes.style[key] = style[key];
wrapper.children.push(border, html);
wrapper.children.push(html);
for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
if (style[key] !== undefined) {
wrapper.attributes.style[key] = style[key];
wrapper.attributes.style.position = style.position === "absolute" ? "absolute" : "relative";
wrapper.attributes.style.alignSelf = style.alignSelf;
function fixTextIndent(styles) {
const indent = getMeasurement(styles.textIndent, "0px");
const align = styles.textAlign === "right" ? "right" : "left";
const name = "padding" + (align === "left" ? "Left" : "Right");
const padding = getMeasurement(styles[name], "0px");
styles[name] = `${padding - indent}px`;
function setAccess(node, classNames) {
classNames.push("xfaNonInteractive");
classNames.push("xfaReadOnly");
classNames.push("xfaDisabled");
function isPrintOnly(node) {
return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
function getCurrentPara(node) {
const stack = node[$getTemplateRoot]()[$extra].paraStack;
return stack.length ? stack.at(-1) : null;
function setPara(node, nodeStyle, value) {
if (value.attributes.class?.includes("xfaRich")) {
nodeStyle.height = "auto";
nodeStyle.width = "auto";
const para = getCurrentPara(node);
const valueStyle = value.attributes.style;
valueStyle.display = "flex";
valueStyle.flexDirection = "column";
valueStyle.justifyContent = "start";
valueStyle.justifyContent = "end";
valueStyle.justifyContent = "center";
const paraStyle = para[$toStyle]();
for (const [key, val] of Object.entries(paraStyle)) {
if (!(key in valueStyle)) {
function setFontFamily(xfaFont, node, fontFinder, style) {
const name = stripQuotes(xfaFont.typeface);
style.fontFamily = `"${name}"`;
const typeface = fontFinder.find(name);
} = typeface.regular.cssFontInfo;
if (fontFamily !== name) {
style.fontFamily = `"${fontFamily}"`;
const para = getCurrentPara(node);
if (para && para.lineHeight !== "") {
const pdfFont = selectFont(xfaFont, typeface);
style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
const absoluteUrl = createValidAbsoluteUrl(str, null, {
addDefaultProtocol: true,
return absoluteUrl ? absoluteUrl.href : null;
;// CONCATENATED MODULE: ./src/core/xfa/layout.js
function createLine(node, children) {
class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
function flushHTML(node) {
const attributes = node[$extra].attributes;
children: node[$extra].children
if (node[$extra].failingNode) {
const htmlFromFailing = node[$extra].failingNode[$flushHTML]();
if (node.layout.endsWith("-tb")) {
html.children.push(createLine(node, [htmlFromFailing]));
html.children.push(htmlFromFailing);
if (html.children.length === 0) {
function addHTML(node, html, bbox) {
const extra = node[$extra];
const availableSpace = extra.availableSpace;
const [x, y, w, h] = bbox;
extra.width = Math.max(extra.width, x + w);
extra.height = Math.max(extra.height, y + h);
extra.children.push(html);
if (!extra.line || extra.attempt === 1) {
extra.line = createLine(node, []);
extra.children.push(extra.line);
extra.line.children.push(html);
if (extra.attempt === 0) {
extra.height = Math.max(extra.height, extra.prevHeight + h);
extra.prevHeight = extra.height;
extra.width = Math.max(extra.width, extra.currentWidth);
extra.children.push(html);
extra.height = Math.max(extra.height, h);
const height = measureToString(extra.height);
for (const child of extra.children) {
child.attributes.style.height = height;
extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
extra.children.push(html);
extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
extra.children.push(html);
function getAvailableSpace(node) {
const availableSpace = node[$extra].availableSpace;
const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
if (node[$extra].attempt === 0) {
width: availableSpace.width - marginH - node[$extra].currentWidth,
height: availableSpace.height - marginV - node[$extra].prevHeight
width: availableSpace.width - marginH,
height: availableSpace.height - marginV - node[$extra].height
const width = node[$extra].columnWidths.slice(node[$extra].currentColumn).reduce((a, x) => a + x);
height: availableSpace.height - marginH
width: availableSpace.width - marginH,
height: availableSpace.height - marginV - node[$extra].height
function getTransformedBBox(node) {
let w = node.w === "" ? NaN : node.w;
let h = node.h === "" ? NaN : node.h;
let [centerX, centerY] = [0, 0];
switch (node.anchorType || "") {
[centerX, centerY] = [w / 2, h];
[centerX, centerY] = [0, h];
[centerX, centerY] = [w, h];
[centerX, centerY] = [w / 2, h / 2];
[centerX, centerY] = [0, h / 2];
[centerX, centerY] = [w, h / 2];
[centerX, centerY] = [w / 2, 0];
[centerX, centerY] = [w, 0];
switch (node.rotate || 0) {
[x, y] = [-centerX, -centerY];
[x, y] = [-centerY, centerX];
[x, y] = [centerX, centerY];
[x, y] = [centerY, -centerX];
return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
function checkDimensions(node, space) {
if (node[$getTemplateRoot]()[$extra].firstUnsplittable === null) {
if (node.w === 0 || node.h === 0) {
const parent = node[$getSubformParent]();
const attempt = parent[$extra]?.attempt || 0;
const [, y, w, h] = getTransformedBBox(node);
if (!node[$getTemplateRoot]()[$extra].noLayoutFailure) {
if (node.h !== "" && Math.round(h - space.height) > ERROR) {
if (Math.round(w - space.width) <= ERROR) {
if (parent[$extra].numberInLine === 0) {
return space.height > ERROR;
return space.width > ERROR;
return Math.round(w - space.width) <= ERROR;
return space.width > ERROR;
if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {
if (node.h !== "" && Math.round(h - space.height) > ERROR) {
if (node.w === "" || Math.round(w - space.width) <= ERROR) {
return space.height > ERROR;
if (parent[$isThereMoreWidth]()) {
return space.height > ERROR;
if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {
if (node.h !== "" && !node[$isSplittable]()) {
return Math.round(h - space.height) <= ERROR;