I am working extensively with Kendo UI Drawing API, specifically with drawDOM and exportPDF methods. I encountered a strange issue, which leads to the generation of corrupt PDF files.
After several attempts to analyze the problem, I found a small piece of code that allows to systematically reproduce the issue. You can find the code as attached.
Opening the example page with Chrome browser I got a corrupted PDF file, while Internet Explorer seems to generate a valid PDF file starting from the same source page.
Checking with an online PDF validator, the file generated by Chrome exploits this validation error:
“The content stream contains an invalid operator.
The operator has an invalid number of operands.”
I’m not skilled with PDF internals, but comparing the valid file of IE and the invalid file of Chrome, I noticed that an “infinite” value appears in the invalid PDF.
The row in the valid PDF is “1 0 0 -1 -9494.7900391 -9965.5996094 cm“, while the same row in the invalid PDF is “1 0 0 -1 Infinity Infinity cm”.
I noticed that the presence of an “Infinite” value is the common behavior whenever the corrupt PDF problem occurs.