Adobe Reader 参数

Adobe Reader Parameters

我正在尝试将 pdf 文件保存为新的 pdf 但正在打印它(需要),我使用 Adob​​e Acrobat 来执行此操作,因为它给我带来了引入参数的选项。 问题是:我需要默默地做(一个Window 都看不到)。所以我需要设置打印机、文件路径和输出目的地。 正如我所说,我需要将其“打印”为新的 pdf,因此我正在使用 Microsoft Print to PDF 来执行此操作(我不知道它是否是更好的选择)。

非常感谢!

            string file = name;
            string pathFile = "C:\DfPrinter\" + name;
            ProcessStartInfo infoPrintPdf = new ProcessStartInfo(); 

               
string printerName = "Microsoft Print to PDF";
                infoPrintPdf.FileName = "C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe";
                infoPrintPdf.Arguments = string.Format("/t" + " '" + pathFile + "'" +"' "  +"'"+printerName+"'");
                infoPrintPdf.CreateNoWindow = true;
                infoPrintPdf.UseShellExecute = false;
                infoPrintPdf.WindowStyle = ProcessWindowStyle.Hidden;
                Process printPdf = new Process();
                printPdf.StartInfo = infoPrintPdf;
                printPdf.Start();

          

  System.Threading.Thread.Sleep(10000);

       

 if (!printPdf.CloseMainWindow())              
            printPdf.Kill(); printPdf.WaitForExit();

我认为 Acrobat Reader 不能静默打印,但您可以考虑使用 Win2PDF "printpdf" command line:

win2pdfd.exe printpdf "filename.pdf" Win2PDF "newfilename.pdf"

这会使用 Win2PDF 打印机以静默方式将 PDF 打印为“newfilename”指定的新 PDF。