svishnevsky / PDFtoPrinter

.Net Wrapper over PDFtoPrinter util allows to print PDF files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not Disposing

buda56 opened this issue · comments

commented

Hi,
Am using this implementation in a Windows Service and am having issues that the PDFToPrint executable is not being removed from memory. When looking at Task Manager I can see up to 20 instances of the PDFToPrint executable.

Regards.
Peter

Hi Peter,

Thanks for your feedback. Could you please tell what package version do you use?

These 20 instances are running after printing is finished and don't exit at all? The wrapper runs new PDFtoPrinter instance per every Print call. So if you use it in parallel code, it's possible to have a number of processes at the same time but them should exit after document is added to the printing queue. If it isn't, could you please send me a source code example?

Also, based on your feedback, I've release a new version of package with concurrency settings. So you can use wrapper as Singleton to control process instance count.

Thanks,
Sergey

commented
commented

Sergey,
We have found another issue as well, it would appear that when mulitiple print jobs are called not all jobs are printing, so if the loop count is > 1 then the print issues appear.

Regards
Peter

Hi Peter,

Thanks for detailed information, this really helped.
the "Print" is asynchronous and you uses it in synchronous code. Could you try to change the method's call like this:
printWrapper.Print(filePath, networkPrinter, printTimeOut).Wait();
to be ensure that printing has started?

commented
commented

Hi,

That great! Feel free to contact me with any issues.