Board index » delphi » Printing jpg pictures URGENT

Printing jpg pictures URGENT

Hi !
I use paradox table with blob field for graphics.

I use jpeg images. In AfterScroll event of tquery i read those blob fields
and put them on qrimage (assign).
When i use Quickreport.preview, i can see my pictures fine in preview
window, but when i try to print them, they are not shown on paper!???

All other (qrdbtext) fields are printed, but pictures are NOT.
I can see them in preview, but not on paper.

PLESE HELP it's pretty urgent.

T a lot IA

 

Re:Printing jpg pictures URGENT


In case you give up on Quickreport, Reportbuilder handles
JPEGs well.

Quote
"Zuxon" <zu...@yahoo.com> wrote in message

news:86fukl$loq12@bornews.borland.com...
Quote
> Hi !
> I use paradox table with blob field for graphics.

> I use jpeg images. In AfterScroll event of tquery i read those blob fields
> and put them on qrimage (assign).
> When i use Quickreport.preview, i can see my pictures fine in preview
> window, but when i try to print them, they are not shown on paper!???

> All other (qrdbtext) fields are printed, but pictures are NOT.
> I can see them in preview, but not on paper.

> PLESE HELP it's pretty urgent.

> T a lot IA

Re:Printing jpg pictures URGENT


Hi,    
I saw your printing problem request... I know how to print images
directly to the printer, but have not used Quickreport... sorry.

I have a question for you, though.  I can read BMP files into my DB
fine, but cannot get JPGs to stay.  I am using a TDBImage component, and
using

mydbimage.picture.LoadFromFile(oppicdlg.FileName);

successfully.  BMP files go into the DB field, and POSTing the record
saves the data.  JPG files show up in the DBImage, but are not saved
when I POST the changes.  Any ideas?

Thanks,
Al

Quote
Zuxon wrote:

> Hi !
> I use paradox table with blob field for graphics.

> I use jpeg images. In AfterScroll event of tquery i read those blob fields
> and put them on qrimage (assign).
> When i use Quickreport.preview, i can see my pictures fine in preview
> window, but when i try to print them, they are not shown on paper!???

> All other (qrdbtext) fields are printed, but pictures are NOT.
> I can see them in preview, but not on paper.

> PLESE HELP it's pretty urgent.

> T a lot IA

Re:Printing jpg pictures URGENT


You must use blob or graphics field for storing jpeg pictures.

Also u can't display them directly in DBImage, but u can read and show them
them on Image.

Here's how you read them :

procedure TForm1.Query1AfterScroll(DataSet: TDataSet);
var
  MS: TMemoryStream;
  J1: TJPEGImage;
begin
  // copy JPEG from Table to Image1
  J1 := TJPEGImage.Create;
  MS := TMemoryStream.Create;
  if Dataset.Fieldbyname('JpgPicture').isnull then // no data available
    Image1.Picture := nil //  <<=== then clear pointer to previous picture!
  else begin
    try
      TBlobField(Dataset.Fieldbyname('JpgPicture')).SaveToStream(MS);
      MS.Seek(soFromBeginning, 0);
      with J1 do begin
        PixelFormat := jf24Bit;
        Scale := jsFullSize;
        Grayscale := False;
        Performance := jpBestQuality;
        ProgressiveDisplay := True;
        ProgressiveEncoding := True;
        LoadFromStream(MS);
      end;
      Image1.Picture.Assign(J1);
    finally
      J1.Free;
      MS.Free;
    end;
  end;
end;

This is AfterScroll event for TQuery (TTable).

You can put images in DB, using TQuery and something like:
Query1.Params[0].LoadFromFile('pic.jpg');

Hope that helps !!!

Other Threads