Hi everyone,
I would like to modify the path of an image external reference. I'm able to do so but if I try to put a wrong path, I get an error message.
Is there a way to do so ?
I'm able to put a bad path for PDF external reference so I thought I could do the same for image.
if (dictDB.Contains(pdfkey))
{
DBDictionary pdfDic = (DBDictionary)tr.GetObject(dictDB.GetAt(pdfkey), OpenMode.ForRead);
foreach (DBDictionaryEntry dbe in pdfDic)
{
if (String.IsNullOrEmpty(dbe.m_key)) continue;
UnderlayDefinition underlayDefinition = (UnderlayDefinition)tr.GetObject(dbe.Value, OpenMode.ForWrite);
cOldFile = underlayDefinition.SourceFileName;
if (aListXrefModif.Contains(cOldFile))
{
underlayDefinition.SourceFileName = aListXrefModif[cOldFile].ToString();
nElementModif = nElementModif + 1;
}
}
}
if (dictDB.Contains(imgkey))
{
DBDictionary imgDic = (DBDictionary)tr.GetObject(dictDB.GetAt(imgkey), OpenMode.ForRead);
foreach (DBDictionaryEntry dbe in imgDic)
{
if (String.IsNullOrEmpty(dbe.m_key)) continue;
RasterImageDef underlayDefinition = (RasterImageDef)tr.GetObject(dbe.Value, OpenMode.ForWrite);
cOldFile = underlayDefinition.SourceFileName;
if (aListXrefModif.Contains(cOldFile))
{
try
{
underlayDefinition.SourceFileName = aListXrefModif[cOldFile].ToString();
nElementModif = nElementModif + 1;
}
catch { }
}
}
}
Thank you !