Ignore Square/Circle-annnotations with a zero borderWidth when creating a fallback appearance stream (issue 14164)
Trying to render these Annotation-types, when the borderWidth is `0`, causes a "hairline" border to appear. If these Annotations included an appearance stream, as they are supposed to, this wouldn't have happened and the simplest solution here seem to be to just ignore these particular Annotations.
This commit is contained in:
		
							parent
							
								
									bbb64369f1
								
							
						
					
					
						commit
						68e6622c57
					
				| @ -2648,6 +2648,11 @@ class SquareAnnotation extends MarkupAnnotation { | |||||||
|       } |       } | ||||||
|       const fillAlpha = fillColor ? strokeAlpha : null; |       const fillAlpha = fillColor ? strokeAlpha : null; | ||||||
| 
 | 
 | ||||||
|  |       if (this.borderStyle.width === 0 && !fillColor) { | ||||||
|  |         // Prevent rendering a "hairline" border (fixes issue14164.pdf).
 | ||||||
|  |         return; | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|       this._setDefaultAppearance({ |       this._setDefaultAppearance({ | ||||||
|         xref: parameters.xref, |         xref: parameters.xref, | ||||||
|         extra: `${this.borderStyle.width} w`, |         extra: `${this.borderStyle.width} w`, | ||||||
| @ -2697,6 +2702,11 @@ class CircleAnnotation extends MarkupAnnotation { | |||||||
|       } |       } | ||||||
|       const fillAlpha = fillColor ? strokeAlpha : null; |       const fillAlpha = fillColor ? strokeAlpha : null; | ||||||
| 
 | 
 | ||||||
|  |       if (this.borderStyle.width === 0 && !fillColor) { | ||||||
|  |         // Prevent rendering a "hairline" border (fixes issue14164.pdf).
 | ||||||
|  |         return; | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|       // Circles are approximated by Bézier curves with four segments since
 |       // Circles are approximated by Bézier curves with four segments since
 | ||||||
|       // there is no circle primitive in the PDF specification. For the control
 |       // there is no circle primitive in the PDF specification. For the control
 | ||||||
|       // points distance, see https://stackoverflow.com/a/27863181.
 |       // points distance, see https://stackoverflow.com/a/27863181.
 | ||||||
|  | |||||||
							
								
								
									
										1
									
								
								test/pdfs/issue14164.pdf.link
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								test/pdfs/issue14164.pdf.link
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | |||||||
|  | https://github.com/mozilla/pdf.js/files/7372181/Test.pdf | ||||||
| @ -973,6 +973,14 @@ | |||||||
|        "enableXfa": true, |        "enableXfa": true, | ||||||
|        "type": "eq" |        "type": "eq" | ||||||
|     }, |     }, | ||||||
|  |     {  "id": "issue14164", | ||||||
|  |        "file": "pdfs/issue14164.pdf", | ||||||
|  |        "md5": "feb444c716b0337efff8094b156def32", | ||||||
|  |        "rounds": 1, | ||||||
|  |        "link": true, | ||||||
|  |        "lastPage": 1, | ||||||
|  |        "type": "eq" | ||||||
|  |     }, | ||||||
|     {  "id": "xfa_filled_imm1344e", |     {  "id": "xfa_filled_imm1344e", | ||||||
|        "file": "pdfs/xfa_filled_imm1344e.pdf", |        "file": "pdfs/xfa_filled_imm1344e.pdf", | ||||||
|        "md5": "0576d16692fcd8ef2366cb48bf296e81", |        "md5": "0576d16692fcd8ef2366cb48bf296e81", | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user