Last Updated: 26 Jun 2023 12:20 by ADMIN
Release LIB 2023.2.703 (03 Jul 2023)
Created on: 23 Jul 2019 13:16
Category: PDFViewer
Type: Bug Report
PdfViewer: Unhandled ArgumentException is thrown when importing document containing CIDFont with negative glyph widths
The CIDFont dictionary may contain an array, describing the widths of the glyphs. If the width has a negative value an ArgumentException: 'Width and Height must be non-negative.', is thrown when the document is imported in RadPdfViewer, which leads to application crash.
Posted on: 24 Jul 2019 17:38
Hello Andrew,

I have answered you in the thread you have submitted in the support system and will post my reply here in case someone else encounters the same question.

As a possible approach you can implement a custom functionality, which inspects the document by searching the byte offset of the "/W [" entry and reads the content until the closing parenthesis ("]") for the array is matched. If you find a negative value, you can disable this document for visualization. I must point out to your attention, that group of glyph widths can be defined as an array inside the widths array. For this reason, you may keep track of the opening and closing parentheses to read the widths array to its end:
/W [ 120 [ 400 325 500 ]
    7080 8032 1000

Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Posted on: 23 Jul 2019 13:22

Thanks for the explanation. Now, is there a way to determine if a PDF document has this CIDFont dictionary with array of negative values? If we are unable to handle the display of the document using the PDFViewer control I would prefer removing it as a selection from the end customer's list of document of which to view. This is time sensitive to our project release. A timely solution would be appreciated.

Your quick response to the initial ticket was great!