1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-24 09:08:07 +02:00

[Annotation] Don't rotate an annotation when it has the NoRotate flag

This commit is contained in:
Calixte Denizet 2023-03-05 13:57:27 +01:00
parent 652a6df62b
commit 3849063d36
6 changed files with 105 additions and 36 deletions

View file

@ -19,7 +19,7 @@
position: absolute;
}
.annotationLayer .buttonWidgetAnnotation.pushButton > img {
.annotationLayer .wasCanvas {
width: 100%;
height: 100%;
position: absolute;

View file

@ -135,6 +135,7 @@ async function convertCanvasesToImages(annotationCanvasMap, outputScale) {
new Promise(resolve => {
canvas.toBlob(blob => {
const image = document.createElement("img");
image.classList.add("wasCanvas");
image.onload = function () {
image.style.width = Math.floor(image.width / outputScale) + "px";
resolve();
@ -625,6 +626,9 @@ class Driver {
let viewport = page.getViewport({
scale: PixelsPerInch.PDF_TO_CSS_UNITS,
});
if (task.rotation) {
viewport = viewport.clone({ rotation: task.rotation });
}
// Restrict the test from creating a canvas that is too big.
const MAX_CANVAS_PIXEL_DIMENSION = 4096;
const largestDimension = Math.max(viewport.width, viewport.height);

View file

@ -7394,5 +7394,32 @@
"rounds": 1,
"link": true,
"type": "eq"
},
{
"id": "annotation-link-text-popup-rotated-90",
"file": "pdfs/annotation-link-text-popup.pdf",
"md5": "4bbf56e81d47232de5f305124ab0ba27",
"rounds": 1,
"type": "eq",
"annotations": true,
"rotation": 90
},
{
"id": "annotation-link-text-popup-rotated-180",
"file": "pdfs/annotation-link-text-popup.pdf",
"md5": "4bbf56e81d47232de5f305124ab0ba27",
"rounds": 1,
"type": "eq",
"annotations": true,
"rotation": 180
},
{
"id": "annotation-link-text-popup-rotated-270",
"file": "pdfs/annotation-link-text-popup.pdf",
"md5": "4bbf56e81d47232de5f305124ab0ba27",
"rounds": 1,
"type": "eq",
"annotations": true,
"rotation": 270
}
]