#1 2021-09-20 04:16:05

missionhq
Member
From: Australia
Registered: 2019-06-11
Posts: 33

TGDIPages, ExportPDFStream and Screen Size when running as a service

I'm not sure if the above relates to my problem but was just wondering what the Delphi 'Screen' global variable is set to when an application is running as a service with no-one logged into the PC?

May actual problem is that my application is running (as a service) on a number of machines, some execute "TGDIPages.ExportPDFStream" just fine (in 1 or 2 seconds), others take forever (upto 1 or 2 hours) for a 2x page document, and typically I can't reproduce the problem on any of my development machines!
And if I run the same program as a console version on the customers machine it works fine (only the Service application version seems to fail)
Any thoughts?

Offline

#2 2021-09-20 07:27:55

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

Re: TGDIPages, ExportPDFStream and Screen Size when running as a service

Any VCL code is not thread-safe. So I guess you should execute all TGDIPages instances in a critical section.

Offline

#3 2021-10-15 00:42:40

missionhq
Member
From: Australia
Registered: 2019-06-11
Posts: 33

Re: TGDIPages, ExportPDFStream and Screen Size when running as a service

I never did work out what the problem actually was, but I changed my code so instead of calling

TGDIPages.ExportPDF ('myfilename.pfc', false, false);

I create my own filestream and call

TGDIPages.ExportPDFStream(MyFileStream);

which seems to have fixed the problem.
Why this problem only appeared on 1 or 2 machines I'll never know......

Offline

Board footer

Powered by FluxBB