--- loncom/interface/lonpdfupload.pm 2010/03/18 19:11:05 1.18 +++ loncom/interface/lonpdfupload.pm 2010/03/22 15:33:38 1.19 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # PDF Form Upload Handler # -# $Id: lonpdfupload.pm,v 1.18 2010/03/18 19:11:05 raeburn Exp $ +# $Id: lonpdfupload.pm,v 1.19 2010/03/22 15:33:38 onken Exp $ # # Copyright Michigan State University Board of Trustees # @@ -192,19 +192,20 @@ sub get_pdf_data() { my @data = (); my $pdf = CAM::PDF->new($env{'form.file'}); - my @formFields = $pdf->getFormFieldList(); #get names of formfields - - foreach my $field (@formFields) { - my $dict = $pdf->getFormFieldDict($pdf->getFormField($field)); # get formfield dictonary + if($pdf) { + my @formFields = $pdf->getFormFieldList(); #get names of formfields + + foreach my $field (@formFields) { + my $dict = $pdf->getFormFieldDict($pdf->getFormField($field)); # get formfield dictonary - # - # this is necessary because CAM::PDF has a problem with formfieldnames which include a - # dot in fieldnames. So a fieldname like "i.am.aFormfield" will offer three fieldnames "i", "i.am" - # and "i.am.aFormfield". The fragmentary names keep no values and will be ignored. - if($dict->{'V'}) { - push(@data, $field."?". $dict->{'V'}{'value'}); #binding fieldname with value + # this is necessary because CAM::PDF has a problem with formfieldnames which include a + # dot in fieldnames. So a fieldname like "i.am.aFormfield" will offer three fieldnames + # "i", "i.am" and "i.am.aFormfield". The fragmentary names keep no values and will be ignored. + if($dict->{'V'}) { + push(@data, $field."?". $dict->{'V'}{'value'}); #binding fieldname with value + } } - } + } return @data; }