使用mathjax表达式生成html文件,并使用html2pdf将其转换为pdf

时间:2015-11-10 22:03:28

标签: javascript php pdf mathjax html2pdf

我必须在PDF中打印出一系列数学表达式。表达式由php函数生成:

<?php

$taskID=$_GET['taskID'];
$pages=GetPDFContent($taskID);
include(__DIR__.'/../../html2pdf/html2pdf.class.php');
$html2pdf = new HTML2PDF('P','A4','de');
$html2pdf->WriteHTML($pages);
$html2pdf->Output("$taskID.pdf");


function GetPDFContent($taskID){
    include("core/lib/connection/db.php");

    [...]

    $html="<page pageset:'new'> 
    <page_header> 
<img src='http://www.mathup.de/images/MathUp_langDE.png' style='width:150px;' id='logoIMG' alt='Logo MathUp'>
    </page_header> 
    <page_footer> 
&copy; $Jahr Peter Mayer
    </page_footer> 
    <div class='PDFContentHeight' style='margin:50px;'>
$$5\\cdot4=20$$
    </div>  
</page><script>MathJax.Hub.Queue(['Typeset',MathJax.Hub]);</script>";

    return $html; } 
?>

我尝试用<script>MathJax.Hub.Queue(['Typeset',MathJax.Hub]);</script>解析表达式 但不幸的是,这不会奏效。

任何人都可以帮我解析表达式吗?

0 个答案:

没有答案