Hence, sanitize these malicious files, we are converting these into PDF/A ie…PDF_A_3A standard using
as this pdf standard does not support these active contents.
This is working fine mostly until we got an System.InvalidCastException error on some of the user uploaded files which is generally edited by a some pdfwriter applications
.I don’t understand why and how to resolve this? Please help me out. We’re using Aspose.Pdf v10.9.
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(fileupload.InputStream);
bool flag = doc.Convert(new MemoryStream(), Aspose.Pdf.PdfFormat.PDF_A_3A, Aspose.Pdf.ConvertErrorAction.Delete);
System.InvalidCastException: Unable to cast object of type ‘a.’ to type ‘a.’.
at ..( , Int32 , Int32 )
at ..(PageCollection )
at ..Process(XmlTextWriter , PdfFormat , Document , Boolean , ConvertErrorAction )
at Aspose.Pdf.Document.Convert(Stream outputLogStream, PdfFormat format, ConvertErrorAction action)