#1 2012-08-23 10:31:27

Etherman
Member
Registered: 2012-08-23
Posts: 1

Using SynPDF inside a Windows Service?

I have a Windows Service app that does emailing for me, and was hoping I could use it to generate PDF attachments.

The end result is that the PDF generated within the service app exists, but it is empty (email arrives with a PDF attached that is empty).

I have incorporated SynPDF into my desktop app which can send the emails with PDF attachments, so the PDF generation and emailing is all working (the same code is used in the service).

I see there are problems with device contexts in a service app, as the service app is not linked to any device, so I have tried enabling the "allow service to interact with desktop" setting.

Is this possible, has anyone tried to do this? I could convert the service app to a start-on-logon desktop app, but I would prefer to keep it as a service app independant of user logons.

I should perhaps note that I am using TPdfDocumentGDI because my document generator can write directly to the VCLCanvas.

Thanks

UPDATE:

Dope! All the warnings in MSDN about not using GDI in a service led me down the wrong path! I can confirm that SynPDF does indeed work fine inside a windows service (and that is with or without the "allow service to interact with desktop" setting).
(do proper debugging before jumping to wrong conclusions - as you could probably guess my problems were mine and not with SynPDF!)

Last edited by Etherman (2012-08-23 11:51:11)

Offline

#2 2012-08-23 14:33:05

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,237
Website

Re: Using SynPDF inside a Windows Service?

smile

Offline

Board footer

Powered by FluxBB