in reply to Re^2: I have a problem in finding corrupted PDF files
in thread I have a problem in finding corrupted PDF files

If the pdf file is corrupted one, it shows the error "Can't read cross-reference section, according to trailer" and terminate the program.

This is exactly one of the cases I had in mind when I said "PDF->new() does die in some cases". As this is a simple, straightforward die message in PDF/Parse.pm (line 82),

sub ReadCrossReference_pass1 { ... $_=PDF::Core::PDFGetline ($fd,\$offset); die "Can't read cross-reference section, according to trailer\n" if +! /xref\r?\n?/ ; ... }

I'm pretty sure (actually, I've tried it) that it will be caught, if you wrap the call in an eval block with curly braces, as shown in my previous reply. That's exactly what that eval BLOCK form (Perl's exception handling mechanism) is for.

If you still can't keep the script running in that case, please post the exact code you're using.