Buffer cannot be null. Parameter name: buffer

I get the exception in the header when I try to convert the attached word document to pdf. I use the following code:

Public Shared Function ConvertWordToPDF(ByVal inputFilename As String) As MemoryStream 
    Using inputstream As FileStream = File.Open(inputFilename, FileMode.Open)
        Return ConvertWordToPDF(inputstream)
    End Using
End Function

Public Shared Function ConvertWordToPDF(ByRef inputStream As Stream) As MemoryStream 
    Dim stream As New MemoryStream()
    Dim doc As New Document(inputStream)
    doc.Save(stream, SaveFormat.Pdf)
    Return stream
End Function

Hi

Thank you for additional information. I tried converting your documents to PDF using the latest version of Aspose.Words and I cannot reproduce the problem on my side. So please try using the latest version. You can download it from here:
https://releases.aspose.com/words/net
Best regards.

Hi,

Strange - I tried with both version 9.4.0.0 and 9.4.1.0 and they both end up with the same error. Then I tried to delete the image at the bottom of page 2 in the document and now it works

Hi

Thank you for additional information. I also have tried one more time with your document, but still cannot reproduce the problem on my side. Could you please create a simple application, which will allow me to reproduce the problem on my side?
Best regards,

Hi,

I think I figured out what the problem is. I’ve been converting a number of word95 files to word97 with the program Convert Doc and it seems that files containing images are the problem. Somehow the converted files contain empty images (maybe wrong references) and that seems to have made the error occur. I can send you a couple of the files if you are interested.

Hi

Thanks for your inquiry. Yes of course, please attach few of them here for testing. It will help as to reproduce the problem.
Best regards,

Hi,

I’ve attached a selection of file that all generate the Buffer error. The original Word95 files are named .bak. It seems as if Convert Doc convert images in the files by moving them to a directory and referencing them from the Word97-document. Something seems to be wrong with these references though, i.e. when I open the files the images are not loaded.

Hi

Thank you for additional information. Unfortunately, I still cannot reproduce the problem on my side.
Best regards,

I’ve fixed the files by opening the original word95 files in word2007 and saving them as 97-2003 files. Now they are converted without any errors. Obviously the converter programme I used made some kind of a mess out of the files…

Hi

It is perfect, that you already resolved the problem. Please let me know in case of any issues. I will be glad to help you.
Best regards,