[fpc-pascal] Text scan in text files - (was: Full text scan - PDF files)
joshyfun at gmail.com
Mon Nov 1 21:52:13 CET 2010
Monday, November 1, 2010, 8:40:45 PM, you wrote:
MD> On Mon, Nov 1, 2010 at 4:27 PM, Alberto Narduzzi
MD> <albertonarduzzi at yahoo.com> wrote:
>>> I agree. But as I search for text within PDF files?
>> I assumed true the following statement of yours...
>> [Somebody can help me please?
>> I need to search strings in Text files using just FPC.]
MD> Yes, I changed my first mail because nobody answered me about search
MD> in PDF files!
Search an string in a pdf directly is far away from trivial, you need
at least a parse.r and a decompressor. The decompressor is not a
problem usually as most files have streams compressed with zlib, but
the parser is very complex, locate the text zones is easy (more or
less) but if the strings have international characters, it implies the
use o CMAPs which is a nighmare.
So if you are looking for ASCII words, use PDF2Text and use the POS
function over the result:
function HaveString(Filename: String; TheString: string): Boolean;
if F.Size>0 then
if AtPos>0 then
More information about the fpc-pascal