Implement reference testing for printing
This commit includes support for rendering pages in printing mode, which, when combined with annotation storage data, is useful for testing if form data is correctly rendered onto the printed canvas.
This commit is contained in:
parent
ebb903e506
commit
8ccf09d5dd
@ -519,7 +519,8 @@ var Driver = (function DriverClosure() {
|
|||||||
|
|
||||||
// Initialize various `eq` test subtypes, see comment below.
|
// Initialize various `eq` test subtypes, see comment below.
|
||||||
var renderAnnotations = false,
|
var renderAnnotations = false,
|
||||||
renderForms = false;
|
renderForms = false,
|
||||||
|
renderPrint = false;
|
||||||
|
|
||||||
var textLayerCanvas, annotationLayerCanvas;
|
var textLayerCanvas, annotationLayerCanvas;
|
||||||
var initPromise;
|
var initPromise;
|
||||||
@ -559,6 +560,7 @@ var Driver = (function DriverClosure() {
|
|||||||
// accidentally changing the behaviour for other types of tests.
|
// accidentally changing the behaviour for other types of tests.
|
||||||
renderAnnotations = !!task.annotations;
|
renderAnnotations = !!task.annotations;
|
||||||
renderForms = !!task.forms;
|
renderForms = !!task.forms;
|
||||||
|
renderPrint = !!task.print;
|
||||||
|
|
||||||
// Render the annotation layer if necessary.
|
// Render the annotation layer if necessary.
|
||||||
if (renderAnnotations || renderForms) {
|
if (renderAnnotations || renderForms) {
|
||||||
@ -604,6 +606,19 @@ var Driver = (function DriverClosure() {
|
|||||||
viewport,
|
viewport,
|
||||||
renderInteractiveForms: renderForms,
|
renderInteractiveForms: renderForms,
|
||||||
};
|
};
|
||||||
|
if (renderPrint) {
|
||||||
|
const annotationStorage = task.annotationStorage;
|
||||||
|
if (annotationStorage) {
|
||||||
|
const docAnnotationStorage = task.pdfDoc.annotationStorage;
|
||||||
|
const entries = Object.entries(annotationStorage);
|
||||||
|
for (const [key, value] of entries) {
|
||||||
|
docAnnotationStorage.setValue(key, value);
|
||||||
|
}
|
||||||
|
renderContext.annotationStorage = docAnnotationStorage;
|
||||||
|
}
|
||||||
|
renderContext.intent = "print";
|
||||||
|
}
|
||||||
|
|
||||||
var completeRender = function (error) {
|
var completeRender = function (error) {
|
||||||
// if text layer is present, compose it on top of the page
|
// if text layer is present, compose it on top of the page
|
||||||
if (textLayerCanvas) {
|
if (textLayerCanvas) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user