Well, after figuring out what system variable "FILEDIA" means, it is just a matter of try-error-try needed to figure out how to feed all the inputs required at command line.
Since you are using Acad2017 (Acad2015 or later), executing Acad command with Editor.Command() method would be much easier than Document.SendStringToExecute() in this case (a command with many user inputs).
Here is the Editor.Command() version of code, which works with my Acad2018:
[CommandMethod("PdfIn")]
public static void ImportPdf()
{
var dwg = CadApp.DocumentManager.MdiActiveDocument;
var ed = dwg.Editor;
try
{
//Save original FILEDIA value and then set it to 0
int fileDia = Convert.ToInt32(CadApp.GetSystemVariable("FILEDIA"));
CadApp.SetSystemVariable("FILEDIA", 0);
ed.Command("-PDFIMPORT", "f", "D:/Temp/TestPdf.pdf", 1, "10.0,10.0", 1.0, 0.0);
}
catch(System.Exception ex)
{
CadApp.ShowAlertDialog(ex.Message);
}
finally
{
//Restore changed FILEDIA value back to original
CadApp.SetSystemVariable("FILEDIA", fileDia);
}
}
However, Editor.Command() can only be called in Document Context. If you want to do it in Application context (such as doing it from button click of a modeless window, you cannot call Editor.Command(), so, a Document.SendStringToExecution(0 version would still needed as below, which also works OK with my Acad2018:
[CommandMethod("PdfIn", CommandFlags.Session)]
public static void ImportPdf()
{
var dwg = CadApp.DocumentManager.MdiActiveDocument;
var ed = dwg.Editor;
//Save origial FILEDIA value
int fileDia = Convert.ToInt32(CadApp.GetSystemVariable("FILEDIA"));
//Set FILEDIA value to 0
dwg.SendStringToExecute("(setvar \"FILEDIA\" 0)\r", true, false, false);
//Start command -PDFIMPORT with pdf file name supplied
var cmd = "-PDFIMPORT f \"D:\\Temp\\TestPdf.pdf\"\r";
dwg.SendStringToExecute(cmd, true, false, false);
// supply page input
dwg.SendStringToExecute("1\r", true, false, false);
// supply insertion location input
dwg.SendStringToExecute("10.0,10.0\r", true, false, false);
// supply scale input
dwg.SendStringToExecute("1.0\r", true, false, false);
// supply rotation input
dwg.SendStringToExecute("30.0\r", true, false, false);
// restore FILEDIA back to original
dwg.SendStringToExecute($"(setvar \"FILEDIA\" {fileDia})\r", true, false, false);
}
Notice that I added CommandFlags.Session to make this command being executed in Application context, thus I must use Document.SendStringToExecution(), rather than Editor.Command().
By the way, this forum is meant for AutoCAD VBA/COM API, while your post is about AutoCAD .NET API, which should be posted in .NET forum.