我试图通过 "进程 "在Adobe Reader中打开该文件,因为Adobe Reader可以修复损坏的文件本身,但我需要在代码层面上 "保存为 "该文件,而不是手动保存,这在.net中可能吗?
我使用的代码是.net。
Process p = new Process();
p.StartInfo.FileName = file;
p.Start();
//Code to Save As this file
p.Close();
corrupt = true;
inputDocument = PdfReader.Open(file, PdfDocumentOpenMode.Import);
你可以用Windows中内置的AutomationAPI戳一下应用程序。
TestStacks.White是我过去用于自动化UI测试的自动化包装器,但它也可以做到你所要求的。https:/teststackwhite.readthedocs.ioenlatest。