Page 1 of 1
dc_fontconfigure in an EXE as service
Posted: Tue Dec 01, 2015 5:35 am
by skiman
Hi,
We have an EXE running as a service. This is working without any problem. Rebooting the server automatically restarts it as a service, without any user action of the need to login on the server.
Now we want to print some document to create PDF files from within this service. It seems as this isn't working, and this gives an error in dc_fontconfigure. I guess this is because there is no presentation space available when running as a service? Anyone who had encountered this problem? Found any solution?
Code: Select all
IF Valtype(oFont) # 'O'
oFont := XbpFont():new( oPS )
oFont:create(cCompoundName)
ENDIF
I was thinking of saving oPS or oFont previously from the desktop, so the service could load this object. Would this make sense?
Re: dc_fontconfigure in an EXE as service
Posted: Tue Dec 01, 2015 5:50 am
by rdonnay
I have had similar problems with IIS running a CXP program.
Printers do not seem to be recognized under the Administrative account.
Re: dc_fontconfigure in an EXE as service
Posted: Tue Dec 01, 2015 6:06 am
by Tom
We're running our services using a local windows account to avoid things like this. If a system account is used, accessing drivers and shares is getting complicated (or is simply not possible). We process export and printing in our services (L&L) and don't have problems with this, although a device context is needed and acquired.
Re: dc_fontconfigure in an EXE as service
Posted: Tue Dec 01, 2015 7:51 am
by skiman
Hi Tom,
What do you mean with a 'local windows account'? We just tried to start the service as 'administrator' instead of 'system'. This doesn't resolve our problem.
Re: dc_fontconfigure in an EXE as service
Posted: Tue Dec 01, 2015 8:06 am
by Tom
Hi, Chris.
A "local windows account" is the account of a concrete windows user (this machine), like "Chris" with the password "iamchris" (Windows login). With this, the service is started using "Chris" as the username and "iamchris" as the password (parameters 4 and 5 of :AddController). When doing this, the context for this user is known by the service, so all devices can be accessed.
Re: dc_fontconfigure in an EXE as service
Posted: Tue Dec 01, 2015 8:58 am
by rdonnay
Thanks for that info Tom. That is very valuable.
I could not find that when doing a Google search.

Re: dc_fontconfigure in an EXE as service
Posted: Wed Dec 02, 2015 7:14 am
by skiman
Hi Tom,
This morning we tried this, and we don't succeed to print. We checked if our PDF-printer driver was available with this account. Anyway, if we login with the account and start our soapserver, everything is working. If we start our soapserver as a service, it isn't working.
Maybe something you do at the startup of the service?
Re: dc_fontconfigure in an EXE as service
Posted: Wed Dec 02, 2015 7:37 am
by Tom
In some (most of the?) situations, a leading ".\" must be added to the windows user name when adding it as the 5th parameter to :addController(). So, if your windows user name is "CHRIS", hand ".\CHRIS" to the servicecontroller.
Re: dc_fontconfigure in an EXE as service
Posted: Wed Dec 02, 2015 8:40 am
by skiman
Ok, we give it a try.
Tom, I just realise that you are probably installing your services via Xbase++ with the servicecontroller()? Maybe that can be the solution, we will try this also.