question

theophilekapapa avatar image
1 Vote"
theophilekapapa asked ThophileKAPAPA-5689 commented

how to use PintDialog control with a PDF file in my path in c#

I have a Pdf document stored in my directory is it possible to print it while using the PrintDialog control in order to select the printer to use.

dotnet-csharp
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks very much it works.

0 Votes 0 ·

1 Answer

Castorix31 avatar image
1 Vote"
Castorix31 answered

You can use "printto" verb, but the AcroRd32.exe process remains at end
(you can add a timer or a thread to kill the process after the printing is done...)

Test without killing AcroRd32 process =>

 PrintDialog printDialog1 = new PrintDialog();
 if (printDialog1.ShowDialog() == DialogResult.OK)
 {   
     Process p = new Process();
     p.StartInfo.FileName = "e:\\test.pdf";
     p.StartInfo.Verb = "printto";                  
     p.StartInfo.Arguments = "\"" + printDialog1.PrinterSettings.PrinterName + "\"";                    
     p.Start();                
 }

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.