I added print
function for the course
information
in Moodle
. Using the TCPDF
library
and javascript
, it prints the following from the $description
variable
:
Course Visibility and Sorting Instructors The «courses» will be sorted first by availability (courses that have been made available to students will show up first followed by courses not available to students), then by semester. For example, if you are teaching a course in the current semester and it is available to students, it will appear at the top of your course listing. If you are teaching a course in the current semester and it is not available to students, it will appear after all the courses that are available to students.
Students first year students second year students post graduate
Note, that «courses»
comes with the original formating in the pdf
!
Here is the code I use in printpdf.php
:
$html = '<html>
<body>
<img src="/moodle/theme/base/pix/logo.png" alt="test alt attribute" border="0" height="100" width="220" allign="left" /><br />
<p><span style="font-size: small;"><font color="#######">Organisation name<br><b>Directorate <br><b>Department </b><br>Subdepartment</font></span></p>
<h2>Course Information</h2>
<h3>'. $title . '</h3><br />
'. $description . '<br />
</body>
</html>';
$pdf->writeHTML($html, true, false, true, false, '');
$pdf->lastPage();
$pdf->Output('CourseInfo.pdf', 'D');
Is it possible, to print it in the original format as on the page with $description
:
Course Visibility and Sorting
Instructors: The «courses» will be sorted first by availability (courses that have been made available to students will show up first followed by courses not available to students), then by semester. For example, if you are teaching a course in the current semester and it is available to students, it will appear at the top of your course listing. If you are teaching a course in the current semester and it is not available to students, it will appear after all the courses that are available to students.
Students:
- first year students
- second year students
- post graduate