Free Support Forum -

Exception converting docx to pdf


I try to convert the attach file from docx to pdf
this is the code im using

var wordstream = File.OpenRead(@“XXX\testword.docx”);
var word = new Aspose.Words.Document(wordstream);
word.Save(@“XXX\testword.pdf”, Aspose.Words.Saving.SaveOptions.CreateSaveOptions(Aspose.Words.SaveFormat.Pdf));

on the word save i get an exception

System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at System.String.Substring(Int32 startIndex, Int32 length)
at x59d6a4fc5007b7a4.xa1a7cce7c5e4a4dc.xcd5f7940e9d851bd(String xd9942531f416cda8, Int32[] xc4313d7c5696eaac)
at x59d6a4fc5007b7a4.xb20bb345580a2369.xcd5f7940e9d851bd()
at x59d6a4fc5007b7a4.xf02702475fd1ff5e.x6012f43a148fc5cf()
at x59d6a4fc5007b7a4.xf02702475fd1ff5e.x550781f8db1cf5f2()
at x59d6a4fc5007b7a4.xa4665f59f0cb55bd.xd22cb714335f8d2c()
at x59d6a4fc5007b7a4.xa4665f59f0cb55bd.get_x35cfcea4890f4e7d()
at x59d6a4fc5007b7a4.x487cdc969fefe3d6.x3967c58a4c5cb5ba()
at x59d6a4fc5007b7a4.x487cdc969fefe3d6.x4e33137198fdb9ca()
at x59d6a4fc5007b7a4.x487cdc969fefe3d6.x47f176deff0d42e2()
at x59d6a4fc5007b7a4.x487cdc969fefe3d6.x83f07df6a659e05b()
at x59d6a4fc5007b7a4.xcde671c53995c411.xd9db07500873ae98(Document x3664041d21d73fdc, xdeb77ea37ad74c56 xdfde339da46db651)
at Aspose.Words.Document.UpdatePageLayout()
at Aspose.Words.Document.x410db0f4a89a6ef1(Boolean x24af0daafcd8fb8c)
at Aspose.Words.Document.get_xcde671c53995c411()
at Aspose.Words.Document.get_PageCount()
at xf989f31a236ff98c.x6c74398bceb133f8.xa2e0b7f7da663553(x8556eed81191af11 x5ac1382edb7bf2c2)
at Aspose.Words.Document.xf381a641001e6830(Stream xcf18e5243f8d5fd3, String xafe2f3653ee64ebc, SaveOptions xc27f01f21f67608c)
at Aspose.Words.Document.Save(String fileName, SaveOptions saveOptions)
at AsposeTest.Program.GenerateWord() in \Aspose\Program.cs:line 123

can you tell if I’m doing something wrong or there is n issue?
I’m using windows 7 64 bit.


Hi Eidan,

Thanks for your inquiry.

While using the latest version of Aspose.Words i.e. 11.8.0, I managed to reproduce this exception on my side. I have logged this issue in our bug tracking system. The issue ID is WORDSNET-7131. Your request has been linked to this issue and you will be notified as soon as it is resolved.

Sorry for the inconvenience.

Best Regards,

The issues you have found earlier (filed as WORDSNET-7131) have been fixed in this .NET update and this Java update.

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