This type of action is currently not supported and a NotSupportedActionException is thrown when accessing such an object.
These exceptions can be handled using the Handling Exceptions mechanism.
When merging documents` pages using the PdfStreamWriter the Form Fields are not copied:
using (PdfStreamWriter fileWriter = new PdfStreamWriter(File.OpenWrite(document2Name)))
{
// Iterate through the files you would like to merge
for (int i = 0; i < 2; i++)
{
// Open each of the files
using (PdfFileSource fileToMerge = new PdfFileSource(File.OpenRead(document1Name)))
{
// Iterate through the pages of the current document
foreach (PdfPageSource pageToMerge in fileToMerge.Pages)
{
// Append the current page to the fileWriter, which holds the stream of the result file
fileWriter.WritePage(pageToMerge);
}
}
}
}
A possible workaround is to use the RadFixedDocument`s Merge() method:
document1.Merge(document2);
I have a simple program that imports a PDF, calls AcroForm.FlattenFormFields(), and calls Export() on the PdfFormatProvider. With the attached example PDF I am seeing the following exception.
System.NotImplementedException: 'The method or operation is not implemented.'
Stack Trace
at Telerik.Windows.Documents.Core.Fonts.Type1.Type1Format.Type1FontSource.GetCapHeight()
at Telerik.Windows.Documents.Core.Fonts.FontSource.get_CapHeight()
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.Fonts.FontDescriptor.CopyRequiredButType3FontPropertiesFrom(FontBase font)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.Fonts.FontDescriptor.CopyPropertiesFrom(IPdfExportContext context, FontBase font)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.Fonts.SimpleFontObject.CopyPropertiesFromOverride(IPdfExportContext context, FontBase font)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.PdfExporter.WriteFontsFromContext(PdfWriter writer, IPdfExportContext context)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.PdfExporter.Export(IRadFixedDocumentExportContext context, Stream output)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.ExceptionHandling.ExecutionHandler.TryHandleExecution[E](Action operation)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.ExportOverride(RadFixedDocument document, Stream output)
The hierarchical document structure is a means to describe the PDF document structure, which is currently not supported. See 10.6.1 Structure Hierarchy on 856 page of the PDF specification for details. This document structure is an alternative to the standard PDF structure and most non-Adobe software does not support it. The document might have been created with Adobe software like Adobe LiveCycle Designer. Very often the document contains some fallback text in the standard PDF structure like: "Please wait... If this message is not eventually replaced by the proper contents of the document, your PDF viewer may not be able to display this type of document." "The document you are trying to load requires Adobe Reader 8 or higher. You may not have the Adobe Reader installed or your viewing environment may not be properly configured to use Adobe Reader. For information on how to install Adobe Reader and configure your viewing environment please see http://www.adobe.com/go/pdf_forms_configure." "For the best experience, open this PDF portfolio in Acrobat X, Reader X, or later."