Regina: This problem seems to be more of a hardware problem than a QR problem. It appears that there is no way to tell QR that the image is done loading before it begins to print the page. What you are doing is my recommendation as well. Perhaps you could check into the idea of loading a file name into a stream and then loading the image from the stream? That would eliminate one bottleneck where you have to use the hard drive to copy the file to a new location just so you can load the file into the image component. As I was looking up the Image properties, I came across the LoadFromClipboardFormat method. You would have to convert the file from a jpg to a bitmap though. Good luck! Tom Nesler -----Original Message----- From: advanced_delphi@yahoogroups.com [mailto:advanced_del...@yahoogroups.com] On Behalf Of Charlie Chambers Sent: Monday, April 27, 2009 7:30 PM To: advanced_delphi@yahoogroups.com Subject: Re: [advanced_delphi] copyFrom needs synched
Hi Regina, I'm not the QR expert in this group but had had my share of frustrations with QR but still use it for most of my involved reports that need a banded approach. Getting things to print in a timely way can be a frustration as i've had code that seemed to work once then totally flip out and end up scratching my head as to what caused the problem. I've in several cases created a simple dbf with blob fields dynamically and printed in that manor where i had images involved. It solved my apparent issues and was reliable. I don't know if that will work for you but might solve the timing issues if all the images were available in the blob before you started printing and not waiting on network traffic. Hopefully Tom Nesler will chime in as to a better solution than mine. Cheers, Charlie ----- Original Message ----- From: Regina Miller <mailto:rmil...@co.grays-harbor.wa.us> To: advanced_delphi@yahoogroups.com Sent: Monday, April 27, 2009 3:32 PM Subject: [advanced_delphi] copyFrom needs synched I am using quick report to create a report of one page for each person. Each person generally has 2 photographs that I need to include on the report. I have two qrImages defined for that. The program controlling the directory that I am getting the pictures from names their picture extensions oddly, ".001", ".002", etc. qrimage's LoadFromFile requires that the image have a picture type extension, so I am copying the file to the c drive, calling it c:\tmp.jpg, then using loadfromfile. That is, in a quick report module, I am using the following (full code below): NewFile.CopyFrom(OldFile, OldFile.Size)); Then I do a "qrimage1.picture.loadfromfile(newfilename) When I print, I am randomly getting blank pictures, where there should be a picture. Randomly, I mean most pictures are showing up, but some will show up on one run, but not on a second run. I am thinking the copy is taking too long, and interferes with my loadfromfile. I added a sleep(200) after the copy, before the loadfromfile, and it seems to work better (i.e. less blanks), but I would certainly rather be more exact about it, then guessing on 2/10 of a second. TIA for any suggestions on improving my code. Regina Regina Miller Lead Analyst, Grays Harbor County (360) 249-4144 ext 457 rmil...@co.grays-harbor.wa.us <mailto:rmil...@co.grays-harbor.wa.us> _______________________________________________________________________ Here is my code. FileName:= '\\ghcxxx\imaging$\cur\names\' + NameNumSuffix + '\' + NameNumAlpha + '.001'; CopyTheImage(FileName); sleep(200); qrImage1.Center:= True; qrImage1.Picture.LoadFromFile('c:\tmp.jpg'); procedure TqrFrmFaceToFace.CopyTheImage(FileName: String); var NewFile: TFileStream; OldFile: TFileStream; begin if NOT FileExists(FileName) then FileName:= BlankJPG; OldFile := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite); try NewFile := TFileStream.Create('C:\tmp.jpg', fmCreate or fmShareDenyRead); try NewFile.CopyFrom(OldFile, OldFile.Size); finally FreeAndNil(NewFile); end; finally FreeAndNil(OldFile); end; end; ________________________________ avast! Antivirus <http://www.avast.com> : Inbound message clean. Virus Database (VPS): 090426-0, 04/26/2009 Tested on: 4/27/2009 6:55:29 PM avast! - copyright (c) 1988-2009 ALWIL Software.