Convertor Error

Convertor Error

Forum member · Jan 31, 2014
Hi, I'm currently evaluating DynamicPDF convertor and have run into a issue when trying to convert a file held as byte[] to a pdf. In that I get the 'System.Exception: Unsupported document'. The code called is byte[] convertedPdf = ceTe.DynamicPDF.Conversion.Converter.Convert(file, filename); where file is a byte[]. If I save the byte[] to a file and then do ceTe.DynamicPDF.Conversion.Converter.Convert(filepath, new filepath); The conversion works OK. Any ideas why using byte[] does not work. Thanks John

Re: Convertor Error

Support · Jan 31, 2014
Hello John, You are getting error most likely because of using wrong file extension in the Convert method which takes input file as byte array and file name with extension as arguments. Please make sure that you are using file name with correct extension and this will work for you. Below is the sample code for it. byte [] byteData = File.ReadAllBytes(@"C:\temp\test.xlsx"); byte[] convertedPDF = Converter.Convert(byteData, "test.xlsx"); Thanks, ceTe Software Support Team

Re: Convertor Error

Forum member · Jan 31, 2014
That was it, I was putting the pdf filename in rather than the original filename. Thanks for that. John.