[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".)
This commit is contained in:
Jonas Jenwald 2020-08-05 12:43:29 +02:00
parent a289eb8325
commit 5e44b241b2
3 changed files with 4 additions and 3 deletions

View File

@ -1133,7 +1133,8 @@ class PDFPageProxy {
pageIndex: this._pageIndex, pageIndex: this._pageIndex,
intent: renderingIntent, intent: renderingIntent,
renderInteractiveForms: renderInteractiveForms === true, renderInteractiveForms: renderInteractiveForms === true,
annotationStorage, annotationStorage:
(annotationStorage && annotationStorage.getAll()) || null,
}); });
} }

View File

@ -57,7 +57,7 @@ function composePage(
transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0], transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0],
viewport: pdfPage.getViewport({ scale: 1, rotation: size.rotation }), viewport: pdfPage.getViewport({ scale: 1, rotation: size.rotation }),
intent: "print", intent: "print",
annotationStorage: pdfDocument.annotationStorage.getAll(), annotationStorage: pdfDocument.annotationStorage,
}; };
return pdfPage.render(renderContext).promise; return pdfPage.render(renderContext).promise;
}) })

View File

@ -54,7 +54,7 @@ function renderPage(
transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0], transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0],
viewport: pdfPage.getViewport({ scale: 1, rotation: size.rotation }), viewport: pdfPage.getViewport({ scale: 1, rotation: size.rotation }),
intent: "print", intent: "print",
annotationStorage: pdfDocument.annotationStorage.getAll(), annotationStorage: pdfDocument.annotationStorage,
}; };
return pdfPage.render(renderContext).promise; return pdfPage.render(renderContext).promise;
}) })