Hello.
I have some problem with converting pdf file to word. And I will be very happy if you help me.
Thanks in advance.
I have used FreeSpire.PDF Version 6.10.6
When I tried to convert PDF to Word using SaveToStream([Stream], [Format]) method in some kind of console app, it worked well.
But when I published it as an Azure Function and tried to run it, I got this exception: "object reference not set to an instance of an object".
This is my code:
private static byte[] ConvertPdfToWord(byte[] pdfByteArray)
{
var pdfDoc = new Spire.Pdf.PdfDocument();
pdfDoc.LoadFromBytes(pdfByteArray);
var wordMS = new MemoryStream();
pdfDoc.SaveToStream(wordMS, Spire.Pdf.FileFormat.DOCX);
return wordMS.ToArray();
}
I don't think it might be because of Azure Function, because I have used MemoryStream many times and they worked very well.