1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-28 23:28:16 +02:00

XFA - Don't display print-only elements

- partial fix for https://bugzilla.mozilla.org/show_bug.cgi?id=1716980.
This commit is contained in:
Calixte Denizet 2021-06-20 15:38:58 +02:00
parent 223b60f4e8
commit d99a7c070f
3 changed files with 42 additions and 2 deletions

View file

@ -368,10 +368,14 @@ function createWrapper(node, html) {
}
const insetsW = insets[1] + insets[3];
const insetsH = insets[0] + insets[2];
const classNames = ["xfaBorder"];
if (isPrintOnly(node.border)) {
classNames.push("xfaPrintOnly");
}
const border = {
name: "div",
attributes: {
class: ["xfaBorder"],
class: classNames,
style: {
top: `${insets[0] - widths[0] + shiftW}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) {
if (family.startsWith("'") || family.startsWith('"')) {
family = family.slice(1, family.length - 1);
@ -482,6 +494,7 @@ export {
fixDimensions,
fixTextIndent,
getFonts,
isPrintOnly,
layoutClass,
layoutText,
measureToString,