When merging, only the widgets are copied but not their fields. This can lead to ArgumentNullException when exporting the document. Implement copying the fields and consider cases which include collision of names of the fields. Workaround: Repair the generated document using the following code:In case of Name collision, you can use the attached project or the attached project to the following feedback item to rename the duplicate fields: Provide a way to rename FormFields.foreach(Widget widgetinthis.pdfDocument.Annotations.Where(annot => annot.Type == AnnotationType.Widget)){if(!this.pdfDocument.AcroForm.FormFields.Contains(widget.Field.Name)){this.pdfDocument.AcroForm.FormFields.Add(widget.Field);}}
Part of the stack trace:
System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
at System.Text.StringBuilder.ExpandByABlock(Int32 minBlockCharCount)
at System.Text.StringBuilder.AppendWithExpansion(Char value)
at System.Text.StringBuilder.Append(Char value)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Utilities.CrossReferenceCollectionReader.GetAllText(Reader reader, Int64 minOffset, Int64 maxOffset)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Utilities.CrossReferenceCollectionReader.FindAllObjectOffsets(Reader reader, Dictionary`2 tokenToOffsets, Int64 minOffset, Int64 maxOffset)Solution - use the ExpandableMemoryStream for the import instead.
Error message:
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.Elements.Functions.FunctionObject'.'Error message:
System.InvalidCastException: 'Unable to cast object of type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.Forms.FormFieldsTree' to type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfArray'.'When importing a large document (e.g. 2.3GB) , the library fails to parse int value that exceeds the limit which leads to endless importing:
Add support for ToUnicode CMap stream. A side effect of not supporting it is the following: exporting PDF document which, for example, contains German umlauts, to plain text, leads to wrong characters in the resulting text. As possible workaround, the PdfFormatProvider instance of RadPdfViewer can be used to import the document. For example:FormatProviderSettings settings =newFormatProviderSettings(ReadingMode.OnDemand);PdfFormatProvider pdfViewerFormatProvider =newPdfFormatProvider(stream, settings);RadFixedDocument document = pdfViewerFormatProvider.Import();TextFormatProvider textFormatProvider =newTextFormatProvider();String text = textFormatProvider.Export(document);
For example exporting the text "\uD83D\uDE0A" with "Segoe UI Symbol" font family should export a single smiling face. Instead the characters are skipped during the export as PdfProcessing is trying to export them as separate char values ("\uD83D" and "\uDE0A") and the font does not contain glyphs corresponding to these char codes.
Text fields should support rich text strings allowing the user to use rich text elements and attributes.