Link to home
Start Free TrialLog in
Avatar of mdiwo
mdiwo

asked on

printing a report from within a service application

Hello,

Before turning to rave reports I tried using TPrinter, but this doesn't seem to work because the service has no Tform ?

Then I tried the rave thingies and managed to save some pdf files and also the preview is working, but when I try to print on paper (by setting the DefaultDest property from TRvSystem to rdPrinter) it doesn't work anymore. In fact it seems the app is hanging after that.

I got no problems in a normal application (containing a form).

Now I wonder if it's possible for a service (application) to print some report.

My service app is written in D7.

Can anyone help me to get a printout on paper from within a service ?

thanks in advance,
mdiwo
 
Avatar of mdiwo
mdiwo

ASKER

Hello again,
Recently I quit working with rave on my problem and began playing on TPrinter again. What I found out is that whenever I access the Printer.Printerindex or similar as for example in the line below, the program stops.

{Original TPrinter code}
procedure TPrinter.SetState(Value: TPrinterState);
...
   with TPrinterDevice(Printers.Objects[PrinterIndex]) do

Is there an expert that could tell me reason for this behaviour ?
An example how the printout would work would be even better...

thanks in advance


Avatar of mdiwo

ASKER

my problem seems to be solved as I found the tzprinter-object from logicomm that seems to work as intended.

imho there is a problem with delphi's own tprinter-object when a service application tries to access some of the printer-properties/methods like on printerindex.
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial