Free Support Forum - aspose.com

How to get the version number of DOCX and PDF using .NET

Dear Support Team,

In the BuildInDocumentProperties, I can retrieve the name of the application and the version of the application that was used to create the document.

If the document was created using MS Word, then I can use the optimizeFor method of the CompatibilityOptions class, to ensure that the rendering (pdf and others) is exactly as it would be using that specific version of MS word.

Is there an easy mapping from the value returned by getVerion (from BuiltInDocumentProperties) and the different constant values in the MsWordVersion class?

Many thanks
Patrick

@PatrickVB

The BuiltInDocumentProperties.Version is related to AppVersion property in app.xml and MS Word does not allow to change it. This property represents the version number of the application that created the document. Following are the version numbers for MS Word.

11.0000 = Word 2003
12.0000 = Word 2007
14.0000 = Word 2010
15.0000 = Word 2013
16.0000 = Word 2016

Could you please share some more detail about your requirement? We will then provide you more information on it.

Dear Tahir,

In the paid support ticket with id=6393, as a workaround for the reported issue (has to do with the save as pdf not being correct), it was recommended to use the optimizeFor functionality.

As I have discovered that the resulting pdf (for the same document) is different (and the differences are significant), my thought was to try to optimize the document using the version number which matches the version used by the creator of the document.

Like this, the resulting pdf, would be the same (at least that is the claim), as if the pdf would have been produced by the creator using his version of MS Word.

That is the reason why I asked if there was any correspondance or mapping between the ver returned by BuiltInDocumentProperties and the constants in MsWordVersion.

Maybe it would be helpfull to have a utility lookup method in MsWordVersion class which is performing the matching.

I hope my explanation is making sense.

KR

Patrick

@PatrickVB

Regarding paid support, please communicate via paid support forum for further detail.

As shared in my previous post, MS Word does not allow to change AppVersion property. As per my understanding, you want to read the PDF version e.g. %PDF-1.7. If this is true, please ZIP and attach your input and output documents along with expected values. We will investigate the issue and provide you more information on it.