The rendering of the image is not fully parsed and the next attribute cannot be properly read.
System.InvalidCastException: 'Unable to cast object of type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfArray' to type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfInt'.'
Some glyphs are not rendered correctly - the letter are translated or become unrecognizable.
The issue is reproducible only for some specific font files. The characters are displayed as rectangles. This seems to caused by incorrect glyph name and glyph id mapping.
When a ToUnicode CMap is defined for Simple Font (TrueType or Type1 font) which maps font character codes to two or more Unicode character values, the extracted text should contain the whole set of characters defined in the mappings. The current implementation of RadPdfViewer takes the first character specified in the ToUnicode mapping which leads to missing characters.
This exception seems to be related to AES algorithm PaddingMode property.
When making changes to Form fields then flattening them and invoking the viewer`s Save method an exception is thrown: System.Collections.Generic.KeyNotFoundException: 'The given key was not present in the dictionary.'
Code to reproduce the issue:
this.pdfViewer.Document.AcroForm.FlattenFormFields();
using (Stream output = File.OpenWrite("Exported.pdf"))
{
this.pdfViewer.Save(output);
}
this.pdfViewer.Document.AcroForm.FlattenFormFields();
using (Stream output = File.OpenWrite("Exported.pdf"))
{
PdfFormatProvider provider = new PdfFormatProvider();
provider.Export(this.pdfViewer.Document, output);
}
Observed when loading a document:
When Windows11Theme is applied before the PdfViewer is initialized the CurrentPageTextBox is not loaded successfully.
Workaround: Set the ApplicationTheme after the InitializeComponent method:
public MainWindow()
{
InitializeComponent();
StyleManager.ApplicationTheme = new Windows11Theme();
}