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

Error in TppPDFXref.Destroy

edited January 2008 in Devices
Sirs

On 29/06/05 Mr Daniel Jeffrey wrote about a problem I am also having with an
Error in TppPDFXref.Destroy, at the time he wrote....


"I use the PDF device and Output stream to store copies of the Report into
the Database.
When I go to PDFDevice.free and trace it through a exception is caused in

TppPDFXref.Destroy

liCount := FPDFObjectList.Count - 1;

for liIndex := liCount downto 0 do
begin
TppPDFObject(FPDFObjectList[liIndex]).Free;
end;

The exception for this particular report always happens when liIndex = 4

Any help would be appreciated

Dan "

Did you resolve this issue as I can not find any further correspondence?

In my case I have tracked the problem down to there being an image on the
report being saved. If I remove the image all is OK. Can you please advise
a suitable course of action, one which does not involve asking the user to
remove their company logo.

Thanks in advance

PLJ

Env RBuilder Enterprise 10.07
Code Gear RAD Studio Delphi 2007

user code which causes this error...

try
lPDFDevice := TppPDFDevice.Create(nil);
FOutputStream := TMemoryStream.Create ;
lPDFDevice.PDFSettings :=
MainDataModule.ppReport1.PDFSettings;

lPDFDevice.OutputStream := FOutputStream;

lPDFDevice.FileName :=
MainDataModule.ppReport1.TextFileName; //if not set tries toi create a file
named ''
lPDFDevice.Publisher :=
MainDataModule.ppReport1.Publisher;
lPDFDevice.OutputStream := FOutputStream;

MainDataModule.ppReport1.PrintToDevices;

FOutputStream.SaveToFile(MainDataModule.ppReport1.TextFileName);
finally
lPDFDevice.Free; // this causes an exception if
there is an image on the report
end;

FOutputStream.Free;

Comments

  • edited January 2008
    Hi Philip,

    I tried your code below with a simple report containing a single image and
    could not recreate the error. If possible, please send a small example I
    can run on my machine that recreates the problem and I'll try to resolve it
    as soon as possible. Send the example in .zip format to
    support@digital-metaphors.com.


    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2008
    Hi

    It seems very sensitive to the template used, the same code gave no problem
    on another machine with a different .rtm file.

    I will try and investigate further.

    Regards

    PLJ

  • edited January 2008
    Hi Nico

    Sample project created and sent as requested.

    Regards

    PLJ

This discussion has been closed.