in reply to Error when trying to loop through DB and run a script
i suspect the problem is in the PDF code which you did not post. i recommend you trim your PDF Stuff down to something small that still produces the error, and troubleshoot that.
specifically, it appears that your $api object has an undef $api->{pdf} value. are you properly constructing a new PDF::API2 object each time through your while loop?
In Section
Seekers of Perl Wisdom