簡體   English   中英

TCPDF打印格式化文本

[英]TCPDF print formatted text

我在Moodlecourse information添加了print功能。 使用TCPDF libraryjavascript ,它從$description variable輸出以下內容:

課程可見性和排序教師“課程”將首先按可用性進行排序(已向學生提供的課程將首先顯示,然后是對學生不可用的課程),然后是一個學期。 例如,如果您正在本學期教授一門課程,並且可供學生使用,則該課程將顯示在課程列表的頂部。 如果您正在本學期教授一門課程,但對學生不可用,則該課程將顯示在對學生可用的所有課程之后。
學生一年級學生二年級學生研究生

請注意, «courses»帶有pdf的原始pdf

這是我在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');

是否可以使用$description頁面上的原始格式進行打印:

課程可見性和排序

講師: 《課程》將首先按可用性進行排序(已向學生提供的課程將首先顯示,然后是對學生不可用的課程),然后是一個學期。 例如,如果您正在本學期教授一門課程,並且可供學生使用,則該課程將顯示在課程列表的頂部。 如果您正在本學期教授一門課程,但對學生不可用,則該課程將顯示在對學生可用的所有課程之后。

學生們:

  • 大一學生
  • 二年級學生
  • 研究生

您可以以html方式更改傳遞給printpdf.php$description變量。

<h2>Course Visibility and Sorting</h2>

 <p>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. </p>

<h2>Students:</h2>
<br>

first year students<br>
second year students<br>
post graduate<br>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM