Using PDF Creator printer simultaneously by multiple threads

Hi,

I am trying to use PDFCreator COM API (PDFCreator.clsPDFCreator class) to print files in multiple theads. File names calculated in runtime. This is what I have tried:

1) Created two objects of PDFCreator.clsPDFCreator class in diffrent theads.
2) Started the printer by calling PDFCreator.cStart method
3)  Adjusted UseAutosaveDirectory, AutosaveDirectory, AutosaveFormat and AutosaveFilename using "set_cOption" method of PDFCreator.clsPDFCreator class to make it auto save.
4) Printing the file by giving installed PDFCreator PrinterName
     // Wait till doc gets queued up.
     while( _PDFCreator.cCountOfPrintjobs != 1 )
      ;

     // Start the printer.
     _PDFCreator.cPrinterStop = false;

     // Wait till all doc get converted to pdf.
     while( _PDFCreator.cCountOfPrintjobs != 0 )
      ;

     // Stop the printer.
     _PDFCreator.cPrinterStop = true;

5) If I run one thread it works perfectly. But it does not work in multiple theads.

What is wrong in above code or any suggestions to achieve whatever I am trying to do.

Goal is:
I need to print documents using PDFCreator printer in my project developed in C# .NET. There could be mutiple threads printing files as same time using PDFCreator printer. File name will be changing at runtime in each process.

Any help will be appriciated.

Thanks.
Dhananjay

www.noesisbase.com

 

You don't need to use the COM API to set the output file name and folder individually for each document; stop using it. Instead, do the following: In the PDFCreator Options property sheet, go to the Auto-save page. Check the Use Auto-save check box. In the Filename edit box, enter . You can also select this from the Add a Filename-Token drop down. Make sure that the contents of this box shows only. Check the Use this directory for auto-save check box. In the edit box below this check box, enter the string \\. In your program, when you print, set the print document name to the full path name of the desired output file, and PDFCreator will put the created document in that folder with the specified name. I believe that the folder needs to exist, so if you are creating a completely new folder, do so before printing. That's all there is to it. FYI, these instructions apply to version 1.4.2 (what I am using).

You don't need to use the COM API to set the output file name and folder individually for each document; stop using it. Instead, do the following: In the PDFCreator Options property sheet, go to the Auto-save page. Check the Use Auto-save check box. In the Filename edit box, enter . You can also select this from the Add a Filename-Token drop down. Make sure that the contents of this box shows only. Check the Use this directory for auto-save check box. In the edit box below this check box, enter the string \\. In your program, when you print, set the print document name to the full path name of the desired output file, and PDFCreator will put the created document in that folder with the specified name. I believe that the folder needs to exist, so if you are creating a completely new folder, do so before printing. That's all there is to it. FYI, these instructions apply to version 1.4.2 (what I am using).