70002050 Setting the folder before opening drawing

Article 70002050
Type HowTo
Product Engine
Version 8
Date Added 9/10/2021 12:00:00 AM
Fixed 9.9002.0.7 (9/10/2021 12:00:00 AM)
Submitted by Wang Zhilong

Summary

Setting the folder before opening drawing so the images with reference paths are loaded properly

Solution

When open is called from the menu and a file dialog is displayed the application sets the current directory to the folder where the file is so these images with reference paths are loaded properly. When you use Doc.Open this doesn’t happen. In order to be loaded properly use a code like:

.......
           var fileFullName = Path.Combine(........, "pdf-cad.vdcl");
           Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(fileFullName));
           doc.Open(fileFullName);
           doc.ZoomAll();
......

Send comments on this topic.