0

Im trying to save a pdf file as a new pdf but printting it (required), Im using Adobe Acrobat to do that cause it brings me the option to introduce parameters. The thing is : I need to do it silently (Not a single Window can been saw). So I need to set a printer, a path to my file and an output destination. As I said I need to "print it" as a new pdf so I'm using Microsoft Print to PDF to do that (I don't know if it is the better option).

Thank you so much!

            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();

1 Answer 1

1

I don't think Acrobat Reader can print silently, but you could consider using the Win2PDF "printpdf" command line:

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

This prints the PDF silently to a new PDF specified by "newfilename" by using the Win2PDF printer.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.