Is there a simple way to convert from dxf to pdf without opening AutoCad? I tried to do this by using AutoCad (ObjectARX) lib in c#, but with no results. The code I tried was this:
{
SaveFileDialog savedlg = new SaveFileDialog();
string st = savedlg.FileName;
int fileExtPos = st.LastIndexOf(".");
if (fileExtPos >= 0)
st = st.Substring(0, fileExtPos);
AcadDocument doc = AcApp.ActiveDocument;
AcadSelectionSet ss = doc.SelectionSets.Add("MySet");
ss.Select(AcSelect.acSelectionSetAll, null, null, null, null);
try
{
if (ss.Count > 0)
{ doc.Export(st, "pdf", ss);
MessageBox.Show("Saved....");
AcApp.Quit();
}
}
finally
{
ss.Delete();
}
}
It was extracted from here: Convert from dwg to pdf
I'm not sure, but it seems that this specific solution only works if you have AutoCad opened (see the AcadDocument doc = AcApp.ActiveDocument;
line).
Do you know any solution better than this? Or can you see where is the error in this solution? The solution could be in any language, so if you know any other solution in any other language, let me know.