2009-08-04 37 views
0

私は、リストボックスにPDFのリストをプリンタに送信するWindowsアプリケーションを持っています。 以下のコードを実行すると、* axAcroPDF1.LoadFile(s)がアプリケーションの各ファイルをロードしていることがわかりますが、AcrobatはlbPDFListリストボックスの最後の項目をプリンタに印刷するように見えます(例:4 PDF印刷するには、常に最後のPDFのみが印刷されます)。Acrobatプラグインを使用して複数のPDF(axAcroPDF1)を印刷する

int iListCounter = lbPDFList.Items.Count; 
       for (int i=0; i < iListCounter; i++) 
       { 
        String s = null; 
        lbPDFList.SetSelected(i,true); 
        s = lbPDFList.SelectedItem.ToString(); 
        axAcroPDF1.LoadFile(s); 
        axAcroPDF1.Show(); 
        axAcroPDF1.printAllFit(true); 
       } 

これはスレッドの問題ですか?

答えて

0

答えは簡単でした。 axAcroPDFオブジェクトを無視し、ちょうど(各PDF印刷するループ内に以下のコードを使用)、Windowsの印刷機能を使用して印刷:何を参照してくださいPD、pd.PrinterSettings.PrinterNameで

// start a new cmd process 
     Process objP = new Process(); 
     objP.StartInfo.FileName = strFilePath; 
     objP.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;   //Hide the window. 
    //!! Since the file name involves a nonexecutable file(.pdf file), including a verb to specify what action to take on the file. 
    //The action in our case is to "Print" a file in a selected printer. 
    //!! Print the document in the printer selected in the PrintDialog !!// 
    objP.StartInfo.Verb = "printto"; 
    objP.StartInfo.Arguments = "/p /h \"" + strFilePath + "\" \"" + pd.PrinterSettings.PrinterName + " \"";//pd.PrinterSettings.PrinterName; 
    objP.StartInfo.CreateNoWindow = true; //!! Don't create a Window. 
    objP.Start();       //!! Start the process !!// 
    objP.CloseMainWindow(); 
+0

を? – Wildhorn

関連する問題