--- loncom/interface/lonpdfupload.pm 2010/03/18 19:11:05 1.18 +++ loncom/interface/lonpdfupload.pm 2011/11/02 15:14:21 1.21 @@ -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.21 2011/11/02 15:14:21 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -130,7 +130,7 @@ sub get_javascripts() { // 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; } sub grade_pdf { - my $result = (); my @pdfdata = @_; my ($result,$meta,%grades,%problems,%foreigncourse,$debug);