-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTML with MathJax content => PDF, client-side only #1
Comments
I tried different work around to export LaTex/Tex based TypeSettings. But current client side libs doesn't support these. So one way is to output the mathematical expressions in SVG, Canvas or HTML/CSS format. Mathjax.js supports the following output rendering format.
Here SVG format uses foreignobject and it's not getting exported by SVG to canvas libraries. Finally I tried HTML & CSS /Common HTML with html2canvas.js. It works but the quality of the output image is poor. Check this fiddle here. You can check and see to improve this quality (or) try some other methods. Good luck!! |
I got another idea, Lets get the content of input panel in text format and before exporting process the content and generate the PDF by code.
`$('#wmd-input').val()`
"Hi this is a formula $$x^2+1$$"
// write regex to test the string and formula
a. If it's a formula like doc.addImage(imgData, 'PNG', x, y, width, height); b. If it's a text add the text using doc.text(x, y, 'Hi this is a formula'); |
@Purush0th : about your 2nd post: good idea ! Instead of Would you have a jsfiddle or a github fork showing this idea? This looks promising! Thanks in advance :) |
@Purush0th : about your 1st post and this jsfiddle : isn't it possible to use SVG instead of PNG to keep the "vector" type instead of bitmap? Because with PNG here the output has quite bad quality. |
Final goal: CTRL+P => triggers download of PDF
Problem: I am unable to render PDF for a page containing MathJax
Related: http://stackoverflow.com/questions/42785850/render-mathjax-into-pdf, http://stackoverflow.com/questions/27706956/render-svg-to-pdf-using-jspdf
Any idea @Purush0th ?
The text was updated successfully, but these errors were encountered: