FR VCL 4 Pro Load Image from Stream

edited April 2013 in FastReport 4.0
HI,
Have searched the forum(s) for code and the documentation that shows how to do this. Nothing dound in the pdf documentation. On the forums there have been no replies to questions asking how to do this. There a a few replies that show loadfromfile as a solution, which does not answer the original question > .1. Using the Picture component OnBerforePrint Event
a.Loading from file I can do OK.
b. Loading from a stream is a problem.

Using the code completion I can see the LoadFromFile and LoadFromStream functions.
LoadFromFile Works easily as I can give it a string and it just works.
LoadFromStream is a problem as I don't know where or how to place the Stream variable so it is accessable to the script code.

Is it possible to LoadFromStream from a TfrxPictureView OnBeforePrint Event?

For anyone looking for some form of loadfromstream for Pictures the following code works, although not event driven.
.....
Var
   S: TFileStream;
   PV: TfrxComponent;
begin
 PV := frxReport.FindObject('Picture1');
 if Assigned (PV)
   then
     begin
       S := TFileStream.Create('C:\Dev\Graphics\Reports\Reports_White.png',fmOpenRead);
       try
         TfrxPictureView (PV).LoadPictureFromStream(S,true);
         frxReport.ShowReport(True);
       finally
         s. Free;
       end;
     end;
end;

Comments

  • edited April 2013
    Hello,

    I don't know if fastscript can handle this but you can create your custom function (see "custom components development").
    procedure LoadPictureFromStream(AComponentName, AStreamName: String);
    Var
      PV: TfrxComponent;
    begin
      PV := frxReport.FindObject(AComponentName);
      if (PV is TfrxPictureView) then
      begin
        if AStreamName = 'One' then
          TfrxPictureView(PV).LoadPictureFromStream(StreamOne, true);
      end;
    end;
    

    Best Regards,
    Cristian Peta
  • edited 2:25AM
    maybe a professional third-party software can help you load images. here are code samples on how to load image from file and load image from url. check to see if you can find some useful tutorial.
    and you can also learn how to create image from stream and byte arry. hope it is helpful to you.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.