Exception: Value cannot be null. Parameter name: position

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

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 reporting this problem to us. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.
The strange thing is that exception does not occur if try to save document to PDF second time. For example the following code will convert your document to PDF:

Document doc = new Document(@"Test001\67841.doc");
try
{
    // Try to update page layout.(Exception will be thrown here)
    doc.UpdatePageLayout();
}
catch (Exception)
{
    // do nothing.
}
// Try to save document to PDF (No exception will be thrown)
doc.Save(@"Test001\out.pdf");

Best regards,

The issues you have found earlier (filed as 20423) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.