hi guys i'm a new pdfsharp user
![Wink ;)](./images/smilies/icon_wink.gif)
i've got a question for you.i'm developing a little library that launch a print with two parameters: a pdf file path and a printer name.
after the print, adobe reader doesn't close itself and i have to close it manually.how could i solve this problem?
here is my simple library
Code:
public class Printer
{
public void PrintPDF(string strPdfPath, string strPrinterName, string strAdobePath)
{
PdfFilePrinter.AdobeReaderPath = @strAdobePath;
PdfFilePrinter printer = new PdfFilePrinter(@strPdfPath, strPrinterName);
try
{
printer.Print();
}
catch (Exception ex)
{
}
}
}
i've noticed that in the pdfsharp library, before process launch, the directive is to "wait" forever, so it doesn't close automatically.how could i do?
from pdfsharp library...
Code:
try
{
//DoSomeVeryDirtyHacksToMakeItWork();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = PdfFilePrinter.adobeReaderPath;
string args = String.Format("/t \"{0}\" \"{1}\"", this.pdfFileName, this.printerName);
Debug.WriteLine(args);
startInfo.Arguments = args;
startInfo.CreateNoWindow = true;
startInfo.ErrorDialog = false;
startInfo.UseShellExecute = false;
if (this.workingDirectory != null && this.workingDirectory.Length != 0)
startInfo.WorkingDirectory = this.workingDirectory;
Process process = Process.Start(startInfo);
if (!process.WaitForExit(milliseconds)) //this line tell that the program have to wiat forever until manual adobe close
{
// Kill Adobe Reader/Acrobat
process.Kill();
}
}