Extract metadata from dwg file


How to extract metadata such as author, createddate, modified date, lastauthor etc from dwg file?

I have tried following code:
var image = Aspose.CAD.Image.Load(“DWG_FILE_PATH”) as Aspose.CAD.FileFormats.Cad.CadImage;
var props = image.Header.HeaderProperties;
foreach (var prop in props)
if (prop.Key == CadHeaderAttribute.LASTSAVEDBY)
string lastsavedby = prop.Value.ToString();
if (prop.Key == CadHeaderAttribute.SUBJECT)
string subject = prop.Value.ToString();
if (prop.Key == CadHeaderAttribute.TITLE)
string title = prop.Value.ToString();
if (prop.Key == CadHeaderAttribute.KEYWORDS)
string keywords = prop.Value.ToString();
if (prop.Key == CadHeaderAttribute.TDUCREATE || prop.Key == CadHeaderAttribute.TDCREATE)
double value = ((CadDoubleParameter)prop.Value[0]).Value ;
DateTime ds = DateTime.FromOADate(value);

Please help.




Can you please share source DWG file. We will investigate this on our end if it is possible using Aspose.CAD to help you out.


Samples are attached.
Also when date properties (like createddate, modifieddate) are extracted using cad header properties CadHeaderAttribute.TDUCREATE and CadHeaderAttribute.TDUPDATE, it extracted double value(e.g. 2453511.9563217941). When this resultant double value is converted using DateTime.FromOADate(value), it resulted following invalid datetime. Could you please help how such double datetime value can be converted into valid datetime.
11/9/8616 12:43:12 PM
3/3/8617 4:36:07 PM

Thanks in advance.
DWG_samples.zip (86.7 KB)



I have observed your requirements. An investigation ticket with ID CADNET-812 has been created in our issue tracking system to investigate to help you out in this issue. This thread has been linked with the issue so that you may be notified once investigation is completed.


We saw this fixed in version 19.7. We are now able to extract metadata like subject, title, comments, lastauthor, keywords etc. But still we are not able to convert the floating point datetime returned by Aspose into valid datetime.
We used CadHeaderAttribute TDUCREATE and TDUPDATE and tried to convert using DateTime.FromOADate(value).



I suggest you to please try using following sample code.

using (CadImage image = (CadImage)Image.Load(fileName))
CadSummaryInfo summary = image.Header.SummaryInfo;

CadSummaryInfo class contains various metadata information


Thanks. It worked.



It’s good to know that suggested options have worked on your end.


I have attached some dwg files which have LastAuthor metadata but Aspose was unable to extract it.
Can you please look on this?

.Last_Author_Not_Extracted.zip (481.9 KB)