Merge pull request #13743 from calixteman/print_radio
XFA - Checkboxes must be printed (bug 1720182)
This commit is contained in:
commit
f1ae7d7b0e
@ -33,7 +33,7 @@ class XfaLayer {
|
|||||||
element.attributes.type === "radio" ||
|
element.attributes.type === "radio" ||
|
||||||
element.attributes.type === "checkbox"
|
element.attributes.type === "checkbox"
|
||||||
) {
|
) {
|
||||||
if (storedData.value === element.attributes.exportedValue) {
|
if (storedData.value === element.attributes.xfaOn) {
|
||||||
html.setAttribute("checked", true);
|
html.setAttribute("checked", true);
|
||||||
}
|
}
|
||||||
if (intent === "print") {
|
if (intent === "print") {
|
||||||
@ -82,6 +82,9 @@ class XfaLayer {
|
|||||||
attributes.name = `${attributes.name}-${intent}`;
|
attributes.name = `${attributes.name}-${intent}`;
|
||||||
}
|
}
|
||||||
for (const [key, value] of Object.entries(attributes)) {
|
for (const [key, value] of Object.entries(attributes)) {
|
||||||
|
// We don't need to add dataId in the html object but it can
|
||||||
|
// be useful to know its value when writing printing tests:
|
||||||
|
// in this case, don't skip dataId to have its value.
|
||||||
if (value === null || value === undefined || key === "dataId") {
|
if (value === null || value === undefined || key === "dataId") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,14 @@ var rasterizeXfaLayer = (function rasterizeXfaLayerClosure() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-shadow
|
// eslint-disable-next-line no-shadow
|
||||||
function rasterizeXfaLayer(ctx, viewport, xfa, fontRules) {
|
function rasterizeXfaLayer(
|
||||||
|
ctx,
|
||||||
|
viewport,
|
||||||
|
xfa,
|
||||||
|
fontRules,
|
||||||
|
annotationStorage,
|
||||||
|
isPrint
|
||||||
|
) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
// Building SVG with size of the viewport.
|
// Building SVG with size of the viewport.
|
||||||
const svg = document.createElementNS(SVG_NS, "svg:svg");
|
const svg = document.createElementNS(SVG_NS, "svg:svg");
|
||||||
@ -316,6 +323,8 @@ var rasterizeXfaLayer = (function rasterizeXfaLayerClosure() {
|
|||||||
xfa,
|
xfa,
|
||||||
div,
|
div,
|
||||||
viewport: viewport.clone({ dontFlip: true }),
|
viewport: viewport.clone({ dontFlip: true }),
|
||||||
|
annotationStorage,
|
||||||
|
intent: isPrint ? "print" : "display",
|
||||||
});
|
});
|
||||||
|
|
||||||
// Some unsupported type of images (e.g. tiff)
|
// Some unsupported type of images (e.g. tiff)
|
||||||
@ -631,6 +640,14 @@ var Driver = (function DriverClosure() {
|
|||||||
renderPrint = false,
|
renderPrint = false,
|
||||||
renderXfa = false;
|
renderXfa = false;
|
||||||
|
|
||||||
|
if (task.annotationStorage) {
|
||||||
|
const entries = Object.entries(task.annotationStorage),
|
||||||
|
docAnnotationStorage = task.pdfDoc.annotationStorage;
|
||||||
|
for (const [key, value] of entries) {
|
||||||
|
docAnnotationStorage.setValue(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var textLayerCanvas, annotationLayerCanvas;
|
var textLayerCanvas, annotationLayerCanvas;
|
||||||
var initPromise;
|
var initPromise;
|
||||||
if (task.type === "text") {
|
if (task.type === "text") {
|
||||||
@ -713,7 +730,9 @@ var Driver = (function DriverClosure() {
|
|||||||
annotationLayerContext,
|
annotationLayerContext,
|
||||||
viewport,
|
viewport,
|
||||||
xfa,
|
xfa,
|
||||||
task.fontRules
|
task.fontRules,
|
||||||
|
task.pdfDoc.annotationStorage,
|
||||||
|
task.renderPrint
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -731,11 +750,6 @@ var Driver = (function DriverClosure() {
|
|||||||
};
|
};
|
||||||
if (renderPrint) {
|
if (renderPrint) {
|
||||||
if (task.annotationStorage) {
|
if (task.annotationStorage) {
|
||||||
const entries = Object.entries(task.annotationStorage),
|
|
||||||
docAnnotationStorage = task.pdfDoc.annotationStorage;
|
|
||||||
for (const [key, value] of entries) {
|
|
||||||
docAnnotationStorage.setValue(key, value);
|
|
||||||
}
|
|
||||||
renderContext.includeAnnotationStorage = true;
|
renderContext.includeAnnotationStorage = true;
|
||||||
}
|
}
|
||||||
renderContext.intent = "print";
|
renderContext.intent = "print";
|
||||||
|
1
test/pdfs/xfa_bug1720182.pdf.link
Normal file
1
test/pdfs/xfa_bug1720182.pdf.link
Normal file
@ -0,0 +1 @@
|
|||||||
|
https://bugzilla.mozilla.org/attachment.cgi?id=9230780
|
@ -952,6 +952,26 @@
|
|||||||
"enableXfa": true,
|
"enableXfa": true,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "xfa_bug1720182",
|
||||||
|
"file": "pdfs/xfa_bug1720182.pdf",
|
||||||
|
"md5": "1351f816f0509fe750ca61ef2bd40872",
|
||||||
|
"link": true,
|
||||||
|
"rounds": 1,
|
||||||
|
"enableXfa": true,
|
||||||
|
"type": "eq",
|
||||||
|
"print": true,
|
||||||
|
"annotationStorage": {
|
||||||
|
"RadioButtonList2707": {
|
||||||
|
"value": "1"
|
||||||
|
},
|
||||||
|
"ComplainantFirstname2710": {
|
||||||
|
"value": "Foo"
|
||||||
|
},
|
||||||
|
"ComplainantLastname2711": {
|
||||||
|
"value": "Bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{ "id": "xfa_bug1718740",
|
{ "id": "xfa_bug1718740",
|
||||||
"file": "pdfs/xfa_bug1718740.pdf",
|
"file": "pdfs/xfa_bug1718740.pdf",
|
||||||
"md5": "fab4277f2c70fd1edb35f597f5fe6819",
|
"md5": "fab4277f2c70fd1edb35f597f5fe6819",
|
||||||
|
Loading…
Reference in New Issue
Block a user