/** * * @param string $answers * @return BubPdf */ function emarking_create_omr_answer_sheet($answers = null) { global $CFG; require_once $CFG->libdir . '/tcpdf/tcpdf.php'; // for more documentation, see the top of this file require_once $CFG->dirroot . '/mod/emarking/lib/openbub/ans_pdf_open.php'; // for more documentation, see the top of this file // Create a new BubPdf object. $BubPdf = new BubPdf('P', 'in', 'LETTER', true); $BubPdf->SetPrintHeader(false); $BubPdf->SetPrintFooter(false); // NewExam sets the margins, etc BP_NewExam($BubPdf, $CorrectAnswersProvided = TRUE); BP_StudentAnswerSheetStart($BubPdf); // A simple 12 question exam foreach ($answers as $options) { BP_AddAnswerBubbles($BubPdf, 'A', $options, 1, FALSE, FALSE); } BP_StudentAnswerSheetComplete($BubPdf); // the CreateExam call can be used to retrieve an array of the zone assignments $myZones = BP_CreateExam($BubPdf); return $BubPdf; }