From 5e44b241b221b15fd0e8fb56b153b444ccba45a7 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Wed, 5 Aug 2020 12:43:29 +0200 Subject: [PATCH] [api-minor] Fix the `annotationStorage` parameter in `PDFPageProxy.render` While the parameter name (clearly) suggests that an `AnnotationStorage`-instance is expected, looking at the only call-sites that include the parameter (i.e. the `PDFPrintServiceFactory` instances) it actually contains just a normal Object. Hence it seems much more reasonable to actually pass a valid `AnnotationStorage`-instance, as the name suggests, and simply have `PDFPageProxy.render` do the `annotationStorage.getAll()` call. (Since we cannot send an `AnnotationStorage`-instance as-is to the worker-thread, given the "structured clone algorithm".) --- src/display/api.js | 3 ++- web/firefox_print_service.js | 2 +- web/pdf_print_service.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/display/api.js b/src/display/api.js index ba7bfdabf..571c24494 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -1133,7 +1133,8 @@ class PDFPageProxy { pageIndex: this._pageIndex, intent: renderingIntent, renderInteractiveForms: renderInteractiveForms === true, - annotationStorage, + annotationStorage: + (annotationStorage && annotationStorage.getAll()) || null, }); } diff --git a/web/firefox_print_service.js b/web/firefox_print_service.js index 11cd0f131..3098c519e 100644 --- a/web/firefox_print_service.js +++ b/web/firefox_print_service.js @@ -57,7 +57,7 @@ function composePage( transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0], viewport: pdfPage.getViewport({ scale: 1, rotation: size.rotation }), intent: "print", - annotationStorage: pdfDocument.annotationStorage.getAll(), + annotationStorage: pdfDocument.annotationStorage, }; return pdfPage.render(renderContext).promise; }) diff --git a/web/pdf_print_service.js b/web/pdf_print_service.js index ebde93a0e..2321f0cf3 100644 --- a/web/pdf_print_service.js +++ b/web/pdf_print_service.js @@ -54,7 +54,7 @@ function renderPage( transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0], viewport: pdfPage.getViewport({ scale: 1, rotation: size.rotation }), intent: "print", - annotationStorage: pdfDocument.annotationStorage.getAll(), + annotationStorage: pdfDocument.annotationStorage, }; return pdfPage.render(renderContext).promise; })