Merge pull request #13592 from calixteman/xfa_print_only
XFA - Don't display print-only elements
This commit is contained in:
commit
e84b3bbf6e
@ -368,10 +368,14 @@ function createWrapper(node, html) {
|
|||||||
}
|
}
|
||||||
const insetsW = insets[1] + insets[3];
|
const insetsW = insets[1] + insets[3];
|
||||||
const insetsH = insets[0] + insets[2];
|
const insetsH = insets[0] + insets[2];
|
||||||
|
const classNames = ["xfaBorder"];
|
||||||
|
if (isPrintOnly(node.border)) {
|
||||||
|
classNames.push("xfaPrintOnly");
|
||||||
|
}
|
||||||
const border = {
|
const border = {
|
||||||
name: "div",
|
name: "div",
|
||||||
attributes: {
|
attributes: {
|
||||||
class: ["xfaBorder"],
|
class: classNames,
|
||||||
style: {
|
style: {
|
||||||
top: `${insets[0] - widths[0] + shiftW}px`,
|
top: `${insets[0] - widths[0] + shiftW}px`,
|
||||||
left: `${insets[3] - widths[3] + shiftH}px`,
|
left: `${insets[3] - widths[3] + shiftH}px`,
|
||||||
@ -460,6 +464,14 @@ function setAccess(node, classNames) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isPrintOnly(node) {
|
||||||
|
return (
|
||||||
|
node.relevant.length > 0 &&
|
||||||
|
!node.relevant[0].excluded &&
|
||||||
|
node.relevant[0].viewname === "print"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function getFonts(family, fontFinder) {
|
function getFonts(family, fontFinder) {
|
||||||
if (family.startsWith("'") || family.startsWith('"')) {
|
if (family.startsWith("'") || family.startsWith('"')) {
|
||||||
family = family.slice(1, family.length - 1);
|
family = family.slice(1, family.length - 1);
|
||||||
@ -482,6 +494,7 @@ export {
|
|||||||
fixDimensions,
|
fixDimensions,
|
||||||
fixTextIndent,
|
fixTextIndent,
|
||||||
getFonts,
|
getFonts,
|
||||||
|
isPrintOnly,
|
||||||
layoutClass,
|
layoutClass,
|
||||||
layoutText,
|
layoutText,
|
||||||
measureToString,
|
measureToString,
|
||||||
|
@ -71,6 +71,7 @@ import {
|
|||||||
fixDimensions,
|
fixDimensions,
|
||||||
fixTextIndent,
|
fixTextIndent,
|
||||||
getFonts,
|
getFonts,
|
||||||
|
isPrintOnly,
|
||||||
layoutClass,
|
layoutClass,
|
||||||
layoutText,
|
layoutText,
|
||||||
measureToString,
|
measureToString,
|
||||||
@ -302,6 +303,10 @@ class Area extends XFAObject {
|
|||||||
class: ["xfaArea"],
|
class: ["xfaArea"],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (isPrintOnly(this)) {
|
||||||
|
attributes.class.push("xfaPrintOnly");
|
||||||
|
}
|
||||||
|
|
||||||
if (this.name) {
|
if (this.name) {
|
||||||
attributes.xfaName = this.name;
|
attributes.xfaName = this.name;
|
||||||
}
|
}
|
||||||
@ -1140,12 +1145,19 @@ class ContentArea extends XFAObject {
|
|||||||
width: measureToString(this.w),
|
width: measureToString(this.w),
|
||||||
height: measureToString(this.h),
|
height: measureToString(this.h),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const classNames = ["xfaContentarea"];
|
||||||
|
|
||||||
|
if (isPrintOnly(this)) {
|
||||||
|
classNames.push("xfaPrintOnly");
|
||||||
|
}
|
||||||
|
|
||||||
return HTMLResult.success({
|
return HTMLResult.success({
|
||||||
name: "div",
|
name: "div",
|
||||||
children: [],
|
children: [],
|
||||||
attributes: {
|
attributes: {
|
||||||
style,
|
style,
|
||||||
class: ["xfaContentarea"],
|
class: classNames,
|
||||||
id: this[$uid],
|
id: this[$uid],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -1515,6 +1527,9 @@ class Draw extends XFAObject {
|
|||||||
if (this.font) {
|
if (this.font) {
|
||||||
classNames.push("xfaFont");
|
classNames.push("xfaFont");
|
||||||
}
|
}
|
||||||
|
if (isPrintOnly(this)) {
|
||||||
|
classNames.push("xfaPrintOnly");
|
||||||
|
}
|
||||||
|
|
||||||
const attributes = {
|
const attributes = {
|
||||||
style,
|
style,
|
||||||
@ -2083,6 +2098,10 @@ class ExclGroup extends XFAObject {
|
|||||||
classNames.push(cl);
|
classNames.push(cl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isPrintOnly(this)) {
|
||||||
|
classNames.push("xfaPrintOnly");
|
||||||
|
}
|
||||||
|
|
||||||
attributes.style = style;
|
attributes.style = style;
|
||||||
attributes.class = classNames;
|
attributes.class = classNames;
|
||||||
|
|
||||||
@ -2331,6 +2350,10 @@ class Field extends XFAObject {
|
|||||||
classNames.push("xfaFont");
|
classNames.push("xfaFont");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isPrintOnly(this)) {
|
||||||
|
classNames.push("xfaPrintOnly");
|
||||||
|
}
|
||||||
|
|
||||||
const attributes = {
|
const attributes = {
|
||||||
style,
|
style,
|
||||||
id: this[$uid],
|
id: this[$uid],
|
||||||
|
@ -13,6 +13,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
.xfaPrintOnly {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.xfaLayer {
|
.xfaLayer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user