diff --git a/test/driver.js b/test/driver.js index ddc89ce76..efc28063e 100644 --- a/test/driver.js +++ b/test/driver.js @@ -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) {