Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Crash in ppCtrls in a Service (TDBImage)

edited December 2005 in General
I have a report that prints to a PDF just fine in a stand alone
application. I use the exact same form with all support files to
print to the PDF in a service. The report uses a lot of TDBImage
components. All dialogs are supprsed. When in application mode, you
press the button a pdf gets created.

I'm getting a crash on line 48xx (indicated by *crash*) of ppCtrls -
this line is subjective as I removed the try except so my handler
could get the correct call stack.

if (lDataType in [dtBLOB, dtGraphic, dtMemo]) then
try
if GraphicClass = TBitmap then
*CRASH* FPicture.Assign(DataPipeline.GetFieldAsPicture(DataField))
else
begin
lImageStream := TMemoryStream.Create;

try
DataPipeline.GetFieldAsStream(DataField,
lImageStream);

{if JPEG is null, stream size will be 0}
if lImageStream.Size > 0 then
begin
lImageStream.Position := 0;
lGraphicClass := GetGraphicClass;
lGraphic := lGraphicClass.Create;
lGraphic.LoadFromStream(lImageStream);
FPicture.Graphic := lGraphic;
lGraphic.Free;
end;

finally
lImageStream.Free;
end; {try, finally}

end;

except
if Band.Report.Engine.Printing then
Band.Report.RaiseException(EPrintError.Create(ppLoadStr(290)))
else
FPicture.Graphic := nil;
end {try, except}

It's obviously having some sort of issue loading the images from
within a service. The exception is simply generating a 'cannot
generate report' error. '

The first thing I would note is that this is a jpeg and not a bitmap -
I suspect that has something to do with it based upon where the crash
happens.

Regards,
Nick Hustak

Comments

  • edited December 2005
    Solution: Include ppJpeg

    On Wed, 21 Dec 2005 16:24:04 -0500, Nick Hustak
This discussion has been closed.