Forum How do I...?

How do i get math formula into pdf using mathjax?

shaik
I am using Mathjax to get math formulas into HTML page.
I want to get same formula into PDF using Prince.

This is my source code:

  <html>
	<body> 
       <span class="math-tex">\(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)</span>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
    </script>
  </body>
</html>


I am running the prince command in commandline:
This is my command:
I am using Version: Prince 8.1 rev 5
     > prince --javascript test.html test1.pdf
     prince: warning: setTimeout is not yet supported


It is generating the PDF but formula not appearing:
It is showing below error in pdf:
 \(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\) .MathJax_Preview {color: #888} #MathJax_Message {position: fixed; left: 1px; bottom: 2px;
background-color: #E6E6E6; border: 1px solid #959595; margin: 0px; padding: 2px 8px; z-index: 102; color: black; font-size: 80%; width: auto; white-space: nowrap} #MathJax_MSIE_Frame {position: absolute; top: 0; left: 0; width: 0px; z-index: 101; border: 0px; margin: 0px; padding: 0px} .MathJax_Error {color: #CC0000; font-style: italic}


I tried With Version: Prince 10 rev 4 its is giving warning like:
PDF Not having the formula.
  prince: warning: setTimeout called too late

Any suggestion.
  1. test2.pdf11.6 kB
    Formula not showing.
mikeday
You may need to run MathJax externally (eg. via PhantomJS) and generate SVG to pass to Prince, until we can support all the necessary JavaScript DOM functions to run it in Prince.
skycaptain
This a common question. See http://www.princexml.com/forum/topic/2971/using-mathjax-with-princexml for example.

Edited by skycaptain

DelmarLarsen
Has there been any advances in this issue. As mathjax get more popular, it would be great to be able to print documents in PDF with them online without client side tricks.
mikeday
Not yet, MathJax is still dependent upon dynamic DOM properties that Prince does not support. One day. :)
I hate to beat a dead horse, but I heard rumors that Prince was operational with MathJax (at least experimentally). I even remember reading a newsletter somewhere on the topic (although I cannot find it now). Was I just dreaming or is this functionality on the horizon or already here (I know I asked this already at the start of summer; please forgive me, but I run a site with 80 million annual users and many of them want to print PDFs resulting in nonstop emails on the topic).
mikeday
At the moment it still requires using PhantomJS.