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."
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'.'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'.'Add support for GoToR action
Note: related item: PdfProcessing: Introduce functionality to preserve GoToR actions during import/export
I have a simple program that imports a PDF, calls AcroForm.FlattenFormFields(), and calls Export() on the PdfFormatProvider. I am seeing the following exception during Import() on a signed W9 form a customer has uploaded into our system. Due to the sensitive nature of the document I cannot upload it, but below is the Sig section. I have tried other example signed PDFs which seem to work fine (See attached)
39 0 obj
<< /Type /Annot /Rotate 0 /AP 180 0 R /Rect [ 105.8515 149.2023 289.4443 261.1185
] /Border [ 0 0 0 ] /M (h<D[×¥\001.ƒ¶AB}«\006iÚ¿E@\024_”W±ÔÃ\030ÙL\020"É]a\012Ú6¡0\000¶Žm1@Ž)
/C [ 1 ] /DA (h<D[×¥\001.ƒ¶AB}«\006.\023âø‰\035\005íöu\002ÊÒ½ùwË@—‹måÿÚ[ ‹í!¨\001)
/F 4 /Subtype /Sig >>
endobj
Exception
System.NotSupportedException: 'Import of annotation with type Sig is not supported.'
Stack Trace
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.Annotations.AnnotationFactory.CreateUnsupportedAnnotationObject(PdfName type)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Converters.TypeAwareConverter`1.CreateInstance(Type type, PostScriptReader reader, IPdfImportContext context, PdfDictionary dictionary)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Converters.Converter.ConvertFromDictionary(Type type, PostScriptReader reader, IPdfImportContext context, PdfDictionary dictionary)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Converters.Converter.Convert(Type type, PostScriptReader reader, IPdfImportContext context, IPdfPrimitive value)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Converters.Converter.Convert(Type type, PostScriptReader reader, IPdfImportContext context, IPdfPrimitive value)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfCollectionBase`1.ConvertElementToType[T](PostScriptReader reader, IPdfImportContext context, IPdfPrimitive element)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfCollectionBase`1.TryGetElement[T](PostScriptReader reader, IPdfImportContext context, TIndex index, T& element)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.Page.<>c__DisplayClass21_0.<CopyPageAnnotationsTo>b__0()
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.ExceptionHandling.ExecutionHandler.TryHandleExecution[E](Action operation)
Introduce Sanitize Document functionality.
https://experienceleague.adobe.com/en/docs/document-cloud-learn/acrobat-learning/advanced-tasks/redact
https://helpx.adobe.com/acrobat/using/removing-sensitive-content-pdfs.html
For instance, we may implement WritePageAsync method in addition to the existing WritePage method. This is a similar scenario as in System.IO.StreamWriter class which has WriteLine and WriteLineAsync methods.