This is not a valid PDF scenario as having appearance state requires having multistate appearances. However, we should handle this invalid document scenario on our side so that the app does not crash with NullReferenceException.
When there is no ToUnicode CMap, the text from the Simple Font instance should be extracted by mapping the glyph name to its corresponding charcode according to Adobe Glyph List. Additionally, the Differences array should be included in these calculations when there is custom encoding. The current implementation of RadPdfViewer makes ToString to the original char id byte value which leads to wrong characters.
BT 48 819.32 Td -16.6 Ts (Some text to display) Tj ET
Currently, when we parse inline image dictionaries we rely on the assumption that the colorspace will be PdfName. However, there are files with complex colorspaces that are PdfArray and InvalidCastException is thrown. All the content after this exception is lost and not visualized by RadPdfViewer.
Add support for Lab color space. Currently alternate color is used to render the pixels, which may result in incorrect colors.
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.'
Even small documents (~30 kb) containing images encoded with CCITTFaxDecode filter can take about 10 seconds to be opened. In 2014 Q1 SP1 such documents load faster.
Implement import of documents containing Type 3 fonts.
This exception seems to be caused because the stream is not decrypted correctly and the stream data is corrupted. For instance when the stream is with FlateDecode filter the exception is InvalidDataException with message "Unknown compression method".
When we render any PDF file with 'x' number of page count and try to enter page 'x+1' in telerik:CurrentPageTextBox and hit enter, it will enable the Previous Page RadButton and if we click Previous Page then it will freeze the application.
System.ArgumentOutOfRangeException: 'pageNo should be greater or equal than 1 and less or equal than 4. (Parameter 'pageNo')'
Workaround: A possible approach could be to attach to the CurrentPageTextBox` KeyDown event in order to restrict the input.
XAML:
<telerik:CurrentPageTextBox x:Name="PART_CurrentPageNumberTextBox"
KeyDown="PART_CurrentPageNumberTextBox_KeyDown"
Text="{Binding FixedDocumentViewer.CurrentPageNumber, Mode=TwoWay}"/>
private void PART_CurrentPageNumberTextBox_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
TextBox textBox = sender as TextBox;
if (textBox != null)
{
if (e.Key == System.Windows.Input.Key.Enter)
{
int pagesCount = this.pdfViewer.PagesCount;
int currentPageNumber = this.pdfViewer.CurrentPageNumber;
if (this.pdfViewer.Document != null && (currentPageNumber < 1 || currentPageNumber > pagesCount))
{
RadFixedPage currentPage = this.pdfViewer.CurrentPage;
int pageNum = this.pdfViewer.Document.Pages.IndexOf(currentPage) + 1;
this.pdfViewer.CurrentPageNumber = pageNum;
}
}
}
}
When modifying Interactive Forms TextBoxField's value the entered changes are preserved after is clicked out of the TextBoxField's editing area. However the changes are not applied when the click is performed on the save button. As possible workaround you can raise a MouseLeftButtonDown event on the RadPdfViewer and after this execute the SaveAsCommand. For example: private void SaveButton_Click(object sender, RoutedEventArgs e) { MouseButtonEventArgs mouseEventArgs = new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Left) { RoutedEvent = FrameworkElement.MouseLeftButtonDownEvent }; ((FrameworkElement)this.pdfViewer.FixedDocumentPresenter).RaiseEvent(mouseEventArgs); this.pdfViewer.CommandDescriptors.SaveAsCommandDescriptor.Command.Execute(null); }