Observed when loading a document:
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);
}
It is actually checked and only the appearance is wrong. When the file is saved the checkboxes states are as expected.
This behavior is observed with PdfImportSettings.ReadOnDemand setting only.
While all the pages and components of the control are rendered on the image, the content is completely missing from it. The issue is a regression caused by the migration of the model and its async rendering introduced in R3 2020.
Workaround: Fallback to the old rendering engine:
this.pdfViewer.DefaultImportSettings.UseOldRendering = true;
PdfImportSettings settings = PdfImportSettings.ReadOnDemand;
settings.UseOldRendering = true;
When importing a document with a missing state separator (e.g. linefeed) in the object stream (ObjStm) an exception is thrown: System.InvalidCastException: 'Unable to cast object of type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfDictionary' to type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfInt'.'
А possible workaround could be handling the exceptions: Handling Exceptions.