1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Handle non-integer Annotation border widths correctly (issue 14203)

The existing code appears to be wrong, since according to the PDF specification the border width of an Annotation only has to be a number and not specifically an integer. Please see:
 - https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf#page=392
 - https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf#G11.2096210
 - https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf#G6.1965562
This commit is contained in:
KouWakai 2021-12-24 22:10:19 +09:00
parent 41dab8e7b6
commit 98158b67a3
4 changed files with 17 additions and 4 deletions

View file

@ -0,0 +1 @@
https://github.com/mozilla/pdf.js/files/7428963/pdfcomment.pdf

View file

@ -4212,6 +4212,15 @@
"rounds": 1,
"type": "eq"
},
{ "id": "issue14203",
"file": "pdfs/issue14203.pdf",
"md5": "26c1c1e7341bc23fb28d805fa516dbbe",
"link": true,
"rounds": 1,
"firstPage": 11,
"lastPage": 11,
"type": "eq"
},
{ "id": "issue11045",
"file": "pdfs/issue11045.pdf",
"md5": "101d4cb649cc006e0f2b14923e8d97d6",

View file

@ -414,10 +414,13 @@ describe("annotation", function () {
describe("AnnotationBorderStyle", function () {
it("should set and get a valid width", function () {
const borderStyle = new AnnotationBorderStyle();
borderStyle.setWidth(3);
const borderStyleInt = new AnnotationBorderStyle();
borderStyleInt.setWidth(3);
const borderStyleNum = new AnnotationBorderStyle();
borderStyleNum.setWidth(2.5);
expect(borderStyle.width).toEqual(3);
expect(borderStyleInt.width).toEqual(3);
expect(borderStyleNum.width).toEqual(2.5);
});
it("should not set and get an invalid width", function () {