diff --git a/src/core/annotation.js b/src/core/annotation.js index a1a7a76a6..3bdf9b788 100644 --- a/src/core/annotation.js +++ b/src/core/annotation.js @@ -2248,7 +2248,11 @@ class WidgetAnnotation extends Annotation { const appearanceDict = (appearanceStream.dict = new Dict(xref)); appearanceDict.set("Subtype", Name.get("Form")); appearanceDict.set("Resources", resources); - appearanceDict.set("BBox", [0, 0, this.width, this.height]); + const bbox = + rotation % 180 === 0 + ? [0, 0, this.width, this.height] + : [0, 0, this.height, this.width]; + appearanceDict.set("BBox", bbox); const rotationMatrix = this.getRotationMatrix(annotationStorage); if (rotationMatrix !== IDENTITY_MATRIX) { diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 7d5ba5fc3..189aa8b1e 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -723,3 +723,4 @@ !issue18529.pdf !issue16742.pdf !chrome-text-selection-markedContent.pdf +!bug1963407.pdf diff --git a/test/pdfs/bug1963407.pdf b/test/pdfs/bug1963407.pdf new file mode 100755 index 000000000..d76c16e1c Binary files /dev/null and b/test/pdfs/bug1963407.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 2ffe7549f..2e90ee9bd 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -12093,5 +12093,19 @@ "md5": "98b19e944339c01c10c503685eee3ad2", "rounds": 1, "type": "eq" + }, + { + "id": "bug1963407", + "file": "pdfs/bug1963407.pdf", + "md5": "49d3d2dd42014d978af6e6ad814e5e64", + "rounds": 1, + "type": "eq", + "save": true, + "print": true, + "annotationStorage": { + "24R": { + "value": "Hello World" + } + } } ] diff --git a/test/unit/annotation_spec.js b/test/unit/annotation_spec.js index a75747b20..1879ac1a8 100644 --- a/test/unit/annotation_spec.js +++ b/test/unit/annotation_spec.js @@ -2257,7 +2257,7 @@ describe("annotation", function () { ); expect(newData.data).toEqual( "2 0 obj\n<< /Subtype /Form /Resources " + - "<< /Font << /Helv 314 0 R>>>> /BBox [0 0 32 10] /Matrix [0 1 -1 0 32 0] /Length 74>> stream\n" + + "<< /Font << /Helv 314 0 R>>>> /BBox [0 0 10 32] /Matrix [0 1 -1 0 32 0] /Length 74>> stream\n" + "/Tx BMC q BT /Helv 5 Tf 1 0 0 1 0 0 Tm 2 2.94 Td (hello world) Tj " + "ET Q EMC\nendstream\nendobj\n" ); @@ -3808,7 +3808,7 @@ describe("annotation", function () { [ "2 0 obj", "<< /Subtype /Form /Resources << /Font << /Helv 314 0 R>>>> " + - "/BBox [0 0 32 10] /Matrix [0 -1 1 0 0 10] /Length 170>> stream", + "/BBox [0 0 10 32] /Matrix [0 -1 1 0 0 10] /Length 170>> stream", "/Tx BMC q", "1 1 10 32 re W n", "0.600006 0.756866 0.854904 rg",