pdfSaver4 not disposedof correctly inside a service

PDF-XChange Drivers API (only) V4/V5
This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-XChange Printer Drivers SDK (only) - VERSION 4 & 5 - Please use the PDF-Tools SDK Forum for Library DLL assistance.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

guy.marom
User
Posts: 98
Joined: Tue Feb 17, 2009 12:08 pm

pdfSaver4 not disposedof correctly inside a service

Post by guy.marom »

I noticed something weird with this process, it stays open even after I stop using the printer (And even using the RemoveOrphanPriners function leaves it open).

The problem is that I have a windows service using the API and it doesn't work.
My code, essentially does the following:
Dim objFactory As New PXCComLib.CPXCControlEx()
Dim objPrint As PXCComLib.CPXCPrinter = DirectCast(objFactory.Printer("", "MyPrinter", "", ""), PXCComLib.CPXCPrinter)
objFactory.RemoveOrphanPrinters("", "MyPrinter")

If I run these lines REPEATEDLY inside a regular application (Windows Forms application for example) it's OK.
In my win service however, this works once. If I try to restart the service then it gets stuck in the line:
Dim objFactory As New PXCComLib.CPXCControlEx()
And after a while I get the following exception:
System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID {217974DB-6777-4A9F-90A7-AA5EBA834BA2} failed due to the following error: 80080005

So I can't start the service again for a while (I did not notice how much time), but if I manually kill the pdfSaver4 process then everything goes back to normal.

Any comments on that?
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3550
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada

Re: pdfSaver4 not disposedof correctly inside a service

Post by Ivan - Tracker Software »

Looks like for some reasons pdfSaver4 cannot create new CPXCControlEx instance. For now I don't know why.
Can you send me sample service application for testing ?
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
guy.marom
User
Posts: 98
Joined: Tue Feb 17, 2009 12:08 pm

Re: pdfSaver4 not disposedof correctly inside a service

Post by guy.marom »

Attached is the source code of a sample service.
I'll mention that we are running the service using a user from our domain. Changing the use to the local system user and allowing it to "Interact with desktop" solved the problem (But that's not a good solution for us).

Thanks,
Guy Marom
You do not have the required permissions to view the files attached to this post.
guy.marom
User
Posts: 98
Joined: Tue Feb 17, 2009 12:08 pm

Re: pdfSaver4 not disposedof correctly inside a service

Post by guy.marom »

On the same note, is the process pdfSaver necessary if I am not printing batch jobs? And if not, how do I prevent it from being loaded?
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3550
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada

Re: pdfSaver4 not disposedof correctly inside a service

Post by Ivan - Tracker Software »

pdfSaver is required in any case
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
guy.marom
User
Posts: 98
Joined: Tue Feb 17, 2009 12:08 pm

Re: pdfSaver4 not disposedof correctly inside a service

Post by guy.marom »

Any news about this?
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3550
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada

Re: pdfSaver4 not disposedof correctly inside a service

Post by Ivan - Tracker Software »

For your info:
Assigning Nothing in .NET doesn't release COM object. To do this, there is method:
System.Runtime.InteropServices.Marshal.ReleaseComObject(spComObj);
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.