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.
|
||||
var renderAnnotations = false,
|
||||
renderForms = false;
|
||||
renderForms = false,
|
||||
renderPrint = false;
|
||||
|
||||
var textLayerCanvas, annotationLayerCanvas;
|
||||
var initPromise;
|
||||
@ -559,6 +560,7 @@ var Driver = (function DriverClosure() {
|
||||
// accidentally changing the behaviour for other types of tests.
|
||||
renderAnnotations = !!task.annotations;
|
||||
renderForms = !!task.forms;
|
||||
renderPrint = !!task.print;
|
||||
|
||||
// Render the annotation layer if necessary.
|
||||
if (renderAnnotations || renderForms) {
|
||||
@ -604,6 +606,19 @@ var Driver = (function DriverClosure() {
|
||||
viewport,
|
||||
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) {
|
||||
// if text layer is present, compose it on top of the page
|
||||
if (textLayerCanvas) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user