Issue with opening PDF file from FilePro

Boaz Bezborodko boaz at mirrotek.com
Sat May 30 11:21:51 PDT 2009


>
> Message: 5 Date: Fri, 29 May 2009 23:45:17 -0400 From: Kenneth Brody 
> <kenbrody at spamcop.net> Subject: Re: Issue with opening PDF file from 
> FilePro To: Fairlight <fairlite at fairlite.com> Cc: 
> filepro-list at lists.celestial.com Message-ID: 
> <4A20ABCD.7030109 at spamcop.net> Content-Type: text/plain; 
> charset=ISO-8859-1; format=flowed Fairlight wrote: [...]
>> > 1) Check for file's existance with exists().  If it's there, open it.  If
>> > you can open it read/write, then:
>> > 
>> > 2) Check the file's size with FILESIZE() on the opened handle.
>> > 
>> > 3) Institute a loop that sleeps for one second.  Close the file, re-open
>> > it, and check FILESIZE() each iteration.  If you go a second with no new
>> > data, you're -probably- safe to exit the loop and proceed onwards.
>>     
>
> There's no need to close/re-open the file.  If the file size changes, then 
> FILESIZE() will see it.  (Unless the O/S lies to filePro, which would mean 
> that bigger things would fail, like adding records to a file with no free 
> records.)
>
>   
>> > NOTE:  I do -not- like this solution, as it IS still subject to a race
>> > condition.
>>     
>
> I'm not sure if I would call it a "race condition".  But, you are depending 
> on the file size changing between checks, which is in no way guaranteed.
>
>   
>> > And if you don't close/re-open the file between checks, be
>> > it on your own head; I'm 50/50 as to whether or not FILESIZE() will pick
>> > up on changes to the file's size once it's opened--depends how it's done
>> > internally.  This could be OS-dependant, or it may be absolute behaviour,
>> > and only Ken can answer that.
>>     
>
> As I said, filePro will see the file size change unless the O/S lies to 
> filePro, which would cause other problems elsewhere.
>
>   
>> > That said, it -should- give reasonably consistent results if you check the
>> > actual size over time.
>>     
I tried this already and it can take a few seconds for the file to start 
changing in size.  It will open the file and the size will change twice 
in the span of a second or two to about 2K as it is first created.  Then 
it will stay the same size for about another 5 or 6 seconds (sometimes 
more) until it jumps to the max file size (for this one page report) of 
about 90K.  So it would require way too much checking to wait around for 
it to change.

The solution that Bob suggested and that I mentioned earlier, where I 
have PrintWizard create a second PDF file from within the same document 
(in this case a single PrintWizard command line appended to the end of 
the report that creates a blank PDF page with a unique filename) gives 
an atomic solution.  When that file exists then the first file must also 
have been finished.  Until then the first file is not ready.

It's actually rather simple and not nearly as kludgy.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.celestial.com/pipermail/filepro-list/attachments/20090530/525f1a99/attachment.html 


More information about the Filepro-list mailing list