Extract metadata from dwg file


#1

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.

Regards,
Balmukunda


#2

@Balmukunda,

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.


#3

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)


#4

@Balmukunda,

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.