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

Error with Jpeg image

edited December 2001 in General
I am using RB 6.03 and D6/win2000.

I have a TppImage in my report and I have a table with jpeg images.
I configured TppImage to JPEG and I include ppJPEG in the uses clause.

When I start to print the report, it works well untill it finds a corrupt
Jpeg image. In this moment it aborts with a error message 'Invalid Image'
and nothing is printed.

How do I can rid of this message so as RB ignore this corrupt image and
continues to print?
I think the correct is ignore a corrupt image instead of abort the report
with a error message.

Thanks in advance,

Luiz.

Comments

  • edited December 2001
    Use a Try Except and maybe load a default 'NoImage.jpg' into the TppImage
    when an exception is rasied.

    try
    ppImage1.Picture.LoadFromFile(plReportData['ImagePath']);
    except
    on EFOpenError do
    ppImage1.Picture.LoadFromFile('C:\Program
    Files\myApplication\Data\NoImage.jpg');
    end;


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited December 2001
    Jim Bennett (Digital Metaphors)" escreveu na
  • edited December 2001
    I saw that you said TppImage, so I assumed that you were taking the
    imagepath from the db, not the blob, sorry. So, you can still place a try
    accept to catch the exception. Don't use a TppDBImage, and use the
    datapipeline to get the blob image, and then assign it to a TppImage in
    code.

    plJPEG is my datapipeline and JPEGImage is my field name for the blob:


    DetailBand.BeforePrint:

    try
    ppImage1.Picture.Graphic.Assign(plJPEG.GetFieldAsPicture('JPEGImage'));

    except
    on EFOpenError do
    ppImage1.Picture.LoadFromFile('C:\error.jpg');
    end;


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.