PdfiumViewer icon indicating copy to clipboard operation
PdfiumViewer copied to clipboard

Exception when rendering corrupt pages with no height

Open Jonowa opened this issue 1 year ago • 0 comments

I've tried to open a PDF document containing a corrupt page with a height of 0. The image renderer throws an exception caused by the invalid value of height. My solution is to set a minimum value to both parameters width and height using Math.Max().

File: PdfDocument.cs Line: 334

var bitmap = new Bitmap(Math.Max(1, width), Math.Max(1, height), PixelFormat.Format32bppArgb);

Jonowa avatar Feb 01 '24 06:02 Jonowa