PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Jul 14, 2024 5:12 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Fri Oct 29, 2010 8:58 am 
Offline

Joined: Fri Oct 29, 2010 8:47 am
Posts: 1
hi guys i'm a new pdfsharp user ;)
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();
        }
      }


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 22 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group