Error when converting DOCX to PDF

Aspose.Words 20.11.0

Error Message
Unable to cast object of type ' ’ to type ' '.

Document.zip (18.2 KB)

@young0308,

After an initial test with the licensed latest (21.1) version of Aspose.Words for .NET, we were unable to reproduce any exception on our end.

We used the following simple C# code to convert your DOCX to PDF format on our end:

Document doc = new Document("C:\\Temp\\document\\document.docx");
doc.Save("C:\\Temp\\document\\21.1.pdf");

We suggest you to please upgrade to the latest version of Aspose.Words for .NET. And also, please make sure that you had provided the correct Document.docx document you are actually getting this problem with.

Error occurred after update.

Full Code.

var fileName = openFileDialog.FileName;

var doc = new Aspose.Words.Document(fileName);

var options = new Aspose.Words.Saving.PdfSaveOptions
{
UseHighQualityRendering = true
};

options.OutlineOptions.DefaultBookmarksOutlineLevel = 1;
options.PageMode = Aspose.Words.Saving.PdfPageMode.UseNone;

doc.LayoutOptions.RevisionOptions.ShowOriginalRevision = false;
doc.LayoutOptions.RevisionOptions.ShowRevisionMarks = false; // This line is causing an error.
doc.LayoutOptions.RevisionOptions.ShowRevisionBars = false;

doc.Save(Path.Combine(Path.ChangeExtension(fileName, “.PDF”)), options);

Error.
image.png (755 Bytes)

@young0308,

We have logged this problem in our issue tracking system with ID WORDSNET-21721. We will further look into the details of this problem and will keep you updated here on the status of correction. We apologize for your inconvenience.

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