Challenge...

Phil Davis davis.phil at comcast.net
Tue Jun 20 16:16:36 EDT 2006


Hi Ton,

Instead of using 'get url' to read the large file, use the open file / 
read file / close file commands. (The 'seek' command might also be 
useful.) That way you don't have to pull the entire file into memory at 
one time. Then you will have better control over the user's experience.

I would go into more detail but I have to run...

Phil Davis



Ton Kuypers wrote:

> Hi gang... I need some help...
>
> A user selects a PDF file, I need to know what colors are in this PDF  
> file.
> So far no good, I can read the data and filter out the unwanted lines.
>
> But this becomes a problem when the PDF file is 50 Mb or bigger...
>
> At this point I use:
>
>         put "file:" & vPDFpath into vURL
>         put url vURL into vColors1
>         put url vURL into vColors2
>         filter vColors1 with "*/Separation*"
>         replace "#20" with space in vColors1
>         filter vColors2 with "*/DeviceN*"
>         replace "#20" with space in vColors2
>         replace "]" with "" in vColors2
>         put vColors1 & vColors2 into vColors
>
> This way I get the lines containing the PDF colors, which I filter  
> and use.
> On normal PDF's this happens on the fly, no delay at all...
>
> But one of my clients now sent me a 200 Mb PDF... And you can guess  
> the problem: The file is loaded into memory twice, taking up more  
> then 400 Mb of memory, just to get 3 or 4 lines of data... It's  
> ssssllloooooowwwwwwwwww....
>
> Any ideas on how to do this faster?
>
>
> Warm regards,
>
> Ton Kuypers
> Digital Media Partners bvba
> Tel. +32 (0)477 / 739 530
> Fax +32 (0)14 / 71 03 04
> http://www.dmp-int.com
>
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list