Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Thu Dec 10, 2020 1:37 pm

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.

hovhannes2103
 
Posts: 1
Joined: Thu Dec 10, 2020 12:56 pm

Fri Dec 11, 2020 7:58 am

Hello,

Thanks for your inquiry.
I tested your scenario but did not reproduce your issue. To help us investigate further, please provide your input file and a runnable project that could reproduce your issue. You could send them to us ([email protected]) via email. Thanks in advance.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.PDF