I think the tools in
PDF::API2 should do it, but I have
not tried to write the code. I'd take
amphiplex's suggestion and
look at the code from xpdf. Then I'd use the PDF::API2 tools to
rewrite the pdf2text. Then I'd post it to perlmonks or CPAN.
HTH, --traveler