Forum Bugs

SVG output differs between Browser and Prince

shivaram
All SVG's are rendering bold and bigger in Prince output

When you open the attached HTML in the browser the output looks okay, but the Prince output looks bolder and bigger. Let me know why SVG breaks in the Prince output pls?

BTW, the SVG is converted using MathJax from MathML (i.e. MathML to SVG)

Attachment contains html, output pdf and pdf-screenshot
  1. test_output.html13.0 kB
  2. test_output.jpg17.8 kB
  3. test_output.pdf46.2 kB
mikeday
It appears to be rendering each glyph as an SVG path element, not using text fonts! That seems unnecessary, is there an option to tell it to use real text?
wangp
Set the MathJax SVG output 'blacker' option to 0.
shivaram
Thank you @Mike and @Wangp.

The Blacker:0 worked well, now the Math looks good - sample attached
  1. index2_MathJax_conv.pdf142.3 kB
mikeday
That looks great! Are you running MathJax in Node or a headless browser to generate the SVG first?
shivaram
Headless browser phantomjs. I've a simple bat file like:
@echo off
set PHANTOMJS=".\libs\phantomjs\bin\phantomjs.exe"
set PRINCE="C:\Prince\engine\bin\prince.exe"
set bookID=%~1
set bookConv=%~2

REM apply mathjax and produce new html for prince
%PHANTOMJS% ..\..\js\render-math.js %bookID% %bookConv%

REM use the html created on previous step
%PRINCE% --log=logs\%bookConv%.log --verbose --debug --javascript --baseurl=${ROOT} %bookConv%.html -o %bookConv%.pdf

mikeday
Neat! I hope we can support MathJax natively within Prince one day. :D
shivaram
Yes, would be good if you guys support MathJax, since on this method the speed of Prince drops when dealing with MathJax applied HTML's.
emperor
@shivaram Any chance of sharing render-math.js with us? Thanks!