BT 48 819.32 Td -16.6 Ts (Some text to display) Tj ET
According to the PDF specification (AdobeĀ® Portable Document Format Version 1.7):
Append a rectangle to the current path as a complete subpath, with lower-left corner (x, y) and dimensions width and height in user space.
The operation:
x y width height re
An invalid case:
0 - 595 -842 re
This leads to an exception thrown: System.NullReferenceException: 'Object reference not set to an instance of an object.'
Hi Telerik Support
We use your Telerik PDF-Viewer since your last Version "UI for WPF R1 2021" which supports Type 3 fonts.
Now the version runs productive by our customers. But after a day, they found some special PDFs that doesn't work quite right with your PDF-Viewer.
In the appendix you will find the PDf-Files as samples for the bugs that i'm describing.
Because of data privacy, the PDF-Files are cutted and cropped.
Also a demo project is appended (It could also be reproduced with the demo Progress Telerik WPF UI for th PDF-Viewer).
First Problem: Blank Page
Hint: It seems that only a few PDF-Files from a specific program seems to be a problem.
Second Problem: Displaying data delayed
I would be glad for a quick possible solution for our customer.
Best regards
Serge Schoop
When importing a document containing Outlines (Bookmarks) containing Actions with an empty dictionary:
<</Title(Bookmarks)/Parent .../First .../Last .../Prev .../A<<>>/Count ...>
leads to an exception thrown: System.MissingMethodException: 'Cannot create an abstract class.'
From the PDF specification:
Prev: (Present only if the file has more than one cross-reference section; must not be an indirect reference) The byte offset from the beginning of the file to the beginning of the previous cross-reference section.
When importing such a document an exception is thrown: System.ArgumentNullException: 'Value cannot be null.
When extracting text from a composite font the ToUnicode mapping should be used but when this mapping is missing the char codes must be mapped by constructing a secondary map from fonts ordering and registry.
A possible workaround could be to register a TrueType font using the FontsRepository.RegisterFont() method:
FontsRepository.RegisterFont(new FontFamily(fontName), FontStyles.Normal, FontWeights.Normal, File.ReadAllBytes(pathToFont));
FontsRepository.TryCreateFont(new FontFamily(fontName), FontStyles.Normal, FontWeights.Normal, out FontBase font);
foreach (RadFixedPage page in document.Pages)
{
foreach (ContentElementBase contentElement in page.Content)
{
if (contentElement is TextFragment textFragment)
{
if (textFragment.Font.Name == fontName)
{
textFragment.Font = font;
}
}
}
}