Switch the order of the "display"/"print" intent handling in XfaLayerBuilder.render
Given that the "print"-intent is special, and that we should always fallback to the "display"-intent, let's ensure that the code actually reflects that. Also, ensure that the method always returns a `Promise` since that's what the documentation says.
This commit is contained in:
parent
eb94d71b71
commit
45c1390c42
@ -43,7 +43,27 @@ class XfaLayerBuilder {
|
|||||||
* annotations is complete.
|
* annotations is complete.
|
||||||
*/
|
*/
|
||||||
render(viewport, intent = "display") {
|
render(viewport, intent = "display") {
|
||||||
if (intent === "display") {
|
if (intent === "print") {
|
||||||
|
viewport.dontFlip = true;
|
||||||
|
const parameters = {
|
||||||
|
viewport,
|
||||||
|
div: this.div,
|
||||||
|
xfa: this.xfaHtml,
|
||||||
|
page: null,
|
||||||
|
annotationStorage: this.annotationStorage,
|
||||||
|
intent,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create an xfa layer div and render the form
|
||||||
|
const div = document.createElement("div");
|
||||||
|
this.pageDiv.appendChild(div);
|
||||||
|
parameters.div = div;
|
||||||
|
|
||||||
|
XfaLayer.render(parameters);
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
|
// intent === "display"
|
||||||
return this.pdfPage
|
return this.pdfPage
|
||||||
.getXfa()
|
.getXfa()
|
||||||
.then(xfa => {
|
.then(xfa => {
|
||||||
@ -74,27 +94,6 @@ class XfaLayerBuilder {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// intent === "print".
|
|
||||||
viewport.dontFlip = true;
|
|
||||||
const parameters = {
|
|
||||||
viewport,
|
|
||||||
div: this.div,
|
|
||||||
xfa: this.xfaHtml,
|
|
||||||
page: null,
|
|
||||||
annotationStorage: this.annotationStorage,
|
|
||||||
intent,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Create an xfa layer div and render the form
|
|
||||||
const div = document.createElement("div");
|
|
||||||
this.pageDiv.appendChild(div);
|
|
||||||
parameters.div = div;
|
|
||||||
|
|
||||||
XfaLayer.render(parameters);
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
this._cancelled = true;
|
this._cancelled = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user