Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Find blank pages in PDF

by starbolin (Hermit)
on Jul 07, 2006 at 04:35 UTC ( [id://559714]=note: print w/replies, xml ) Need Help??


in reply to Find blank pages in PDF

Your code assumes getPageText() returns an empty string when there are no text blocks in the PDF. This is probably an incorrect assumption. In general, a function in list context could be returning a false (-1), an undef or a string with whitespace. (tab, cr, etc). Try this:

{ my $foo = $doc->getPageText($_) ; print $_ unless (defined $foo && # Returned something and, $foo =~ m/[[:alnum:]]+/ms ); # actually returned text }

Sorry, I didn't actually test this.

update: fixed that dratted ~=/=~ update: fixed regex, tested now.

s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://559714]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-26 00:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found