Converting HTML with Mathematical Symbols to PDF with Javascript support PHP

Converting HTML with Mathematical Symbols to PDF with Javascript support PHP

If you rely on JavaScript you have two options:

  1. Render on the client and capture the generated document content. You can then send that content to the server for rendering to PDF. dompdf does not currently support SVG, so with this method you would have to use another output format or another library (Im not sure which ones support SVG). The main drawback is that this does require user interaction.
  2. Use a headless browser. These are full browser engines compiled into a command line client. These usually support the full web stack (HTML, CSS, JavaScript, SVG). The web content is rendered in memory after which you can export to PDF and image formats. The best Ive seen so far is PhantomJS. The only drawback is that you have to be able to install binaries on your system and execute them.

Converting HTML with Mathematical Symbols to PDF with Javascript support PHP

Leave a Reply

Your email address will not be published. Required fields are marked *