We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

InValidCastException when saving a Word document to pdf

Hi,


When I tried converting a document to pdf, InvalidCasteException (“Unable to cast object of type ' ’ to type ' '.”) occurs. Code:

Document convertedDocument = new Document(@“test”);
convertedDocument.Save(“test.pdf”);

From the stacktrace it seems to come from convertedDocument.UpdatePageLayout(); so I tried this method and I saw the same exception.

I have attached the Word test document, could you please have a look on this?

Thanks,
Hi John,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-15405. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@ServerSide527,

The issues you have found earlier (filed as WORDSNET-15405) have been fixed in this Aspose.Words for .NET 17.7 update and this Aspose.Words for Java 17.7 update.