original_string: public static function get_error_image($errorimagefolder, $pageno) {
          global $CFG;
  
          $errorfile = $CFG->dirroot . self::BLANK_PDF;
          if (!file_exists($errorfile)) {
              throw new \coding_exception("Blank PDF not found", "File path" . $errorfile);
          }
  
          $tmperrorimagefolder = make_request_directory();
  
          $pdf = new pdf();
          $pdf->set_pdf($errorfile);
          $pdf->copy_page();
          $pdf->add_comment(get_string('errorpdfpage', 'assignfeedback_editpdf'), 250, 300, 200, "red");
          $generatedpdf = $tmperrorimagefolder . '/' . 'error.pdf';
          $pdf->save_pdf($generatedpdf);
  
          $pdf = new pdf();
          $pdf->set_pdf($generatedpdf);
          $pdf->set_image_folder($tmperrorimagefolder);
          $image = $pdf->get_image(0);
          $pdf->Close(); // PDF loaded and never saved/outputted needs to be closed.
          $newimg = self::IMAGE_PAGE . $pageno . '.png';
  
          copy($tmperrorimagefolder . '/' . $image, $errorimagefolder . '/' . $newimg);
          return $newimg;
      }
code: public static function get_error_image($errorimagefolder, $pageno) {
          global $CFG;
  
          $errorfile = $CFG->dirroot . self::BLANK_PDF;
          if (!file_exists($errorfile)) {
              throw new \coding_exception("Blank PDF not found", "File path" . $errorfile);
          }
  
          $tmperrorimagefolder = make_request_directory();
  
          $pdf = new pdf();
          $pdf->set_pdf($errorfile);
          $pdf->copy_page();
          $pdf->add_comment(get_string('errorpdfpage', 'assignfeedback_editpdf'), 250, 300, 200, "red");
          $generatedpdf = $tmperrorimagefolder . '/' . 'error.pdf';
          $pdf->save_pdf($generatedpdf);
  
          $pdf = new pdf();
          $pdf->set_pdf($generatedpdf);
          $pdf->set_image_folder($tmperrorimagefolder);
          $image = $pdf->get_image(0);
          $pdf->Close(); // PDF loaded and never saved/outputted needs to be closed.
          $newimg = self::IMAGE_PAGE . $pageno . '.png';
  
          copy($tmperrorimagefolder . '/' . $image, $errorimagefolder . '/' . $newimg);
          return $newimg;
      }
code_tokens: public static function get_error_image ( $ errorimagefolder , $ pageno ) { global $ CFG ; $ errorfile = $ CFG -> dirroot . self :: BLANK_PDF ; if ( ! file_exists ( $ errorfile ) ) { throw new \ coding_exception ( "Blank PDF not found" , "File path" . $ errorfile ) ; } $ tmperrorimagefolder = make_request_directory ( ) ; $ pdf = new pdf ( ) ; $ pdf -> set_pdf ( $ errorfile ) ; $ pdf -> copy_page ( ) ; $ pdf -> add_comment ( get_string ( 'errorpdfpage' , 'assignfeedback_editpdf' ) , 250 , 300 , 200 , "red" ) ; $ generatedpdf = $ tmperrorimagefolder . '/' . 'error.pdf' ; $ pdf -> save_pdf ( $ generatedpdf ) ; $ pdf = new pdf ( ) ; $ pdf -> set_pdf ( $ generatedpdf ) ; $ pdf -> set_image_folder ( $ tmperrorimagefolder ) ; $ image = $ pdf -> get_image ( 0 ) ; $ pdf -> Close ( ) ; // PDF loaded and never saved/outputted needs to be closed. $ newimg = self :: IMAGE_PAGE . $ pageno . '.png' ; copy ( $ tmperrorimagefolder . '/' . $ image , $ errorimagefolder . '/' . $ newimg ) ; return $ newimg ; }
docstring: Generate an localised error image for the given pagenumber.
  
  @param string $errorimagefolder path of the folder where error image needs to be created.
  @param int $pageno page number for which error image needs to be created.
  
  @return string File name
  @throws \coding_exception
docstring_tokens: Generate an localised error image for the given pagenumber .