Large Docs with Many Pictures
Posted: Mon Oct 31, 2005 5:54 am
Hi -- I am using trichview to create large documents with many (>150) full screen bitmaps. Psuedo code looks something like this...(apologies for poor formatting, my spacing is being deleted by the board)
Source := tjpegimage.create;
for i := 1 to numpages do
begin
PageNum := PageNum +1;
NextItem := rvReport.ItemCount;
rvReport.PageBreaksBeforeItems[rvReport.ItemCount-1]:=TRUE;
Try
Screen := tBitMap.Create;
Source.LoadFromFile(CurrentPage.Path);
Source.Scale := jsHalf;
Screen.Assign(Source);
rvReport.AddFromNewLine(' ',NORMAL);
rvReport.AddPicture(Screen);
//Screen.Dormant;
//Screen.FreeImage;
//Screen.Free;
Except on E:Exception Do
showmessage(E.Message);
End;
end
Lots of detail left out, but that is the basic idea. Note the three commented lines...this uses a ton of memory, and on larger reports, I exhuast the machine so badly it wanders off and gets lost. I would like to find a more efficient method...but I cannot do the freeing in the three commented lines, since AddPicture needs the bitmap in place until the report is done, right? Any suggestions...these reports could be in the many hundreds of bitmaps. Any ideas greatly appreciated.
Source := tjpegimage.create;
for i := 1 to numpages do
begin
PageNum := PageNum +1;
NextItem := rvReport.ItemCount;
rvReport.PageBreaksBeforeItems[rvReport.ItemCount-1]:=TRUE;
Try
Screen := tBitMap.Create;
Source.LoadFromFile(CurrentPage.Path);
Source.Scale := jsHalf;
Screen.Assign(Source);
rvReport.AddFromNewLine(' ',NORMAL);
rvReport.AddPicture(Screen);
//Screen.Dormant;
//Screen.FreeImage;
//Screen.Free;
Except on E:Exception Do
showmessage(E.Message);
End;
end
Lots of detail left out, but that is the basic idea. Note the three commented lines...this uses a ton of memory, and on larger reports, I exhuast the machine so badly it wanders off and gets lost. I would like to find a more efficient method...but I cannot do the freeing in the three commented lines, since AddPicture needs the bitmap in place until the report is done, right? Any suggestions...these reports could be in the many hundreds of bitmaps. Any ideas greatly appreciated.