MathJax html render to pdf - php

I am trying to make an online quiz application where the user will be presented with a quiz that contains text, images and math equations. I also want the user to be able to print that quiz. I am using MathJax to display the equations.
If the quiz contains just text and images but no math equations, I can use DomPdf to convert the quiz HTML to a PDF and have the user print it.
However, how can I go about creating a PDF that has both the content from the HTML tags in the quiz and the math equations from the quiz rendered by MathJax?

According to this post: http://sourceforge.net/projects/mathjax/forums/forum/948700/topic/3819537
wkhtmltopdf can convert the mathjax if you force a delay on the javascript rendering. I just got finished talking to a guy here:
Printing the current page to pdf using wkhtmltopdf
about how to get a page saved to pdf using wkhtmltopdf from php. If you put those two things together, I think you can get what you want.

Related

Math equations are not displayed in exported pdf?

I'm using yii2 mpdf extension for print page, and using "mathjax" plugin for write mathematical equations. Equations are displayed correctly in web page but not displayed in printed pdf.

I want to generate PDF using page

I want to generate PDFs in PHP. How can I do this?
I tried generating page PDF using MPDF but it can't generate the whole thing on page like extra images on pages and details etc..

How to render HTML and graphics on top of existing PDF using wkhtmltopdf

I have these inputs:
an HTML page
an Existing PDF, and some more HTML/stuff I want to draw on top of that PDF (text, html, circles)
an HTML Page
I want to render a 3-page PDF, and have them all be displayed on in a single PDF.
In other words, my question is How do I use an existing PDF as a template for more input
Can this be done from PHP and how?
Unfortunately, with wkhtmltopdf, you can't modify/edit an existing PDF.
With a custom XSL using this code, you could easily do it.
http://www.cloudformatter.com/CSS2Pdf.APIDoc.Usage
The backend rendering engine is XSL FO based which supports injecting a PDF as a background image.
So easy, I did you a sample. Go to this page:
http://www.cloudformatter.com/CSS2Pdf.CustomTipsTricks.BackgroundImages
Click the Open-> PDF button.
The "Top Secret" PDF is injected as a background, the HTML overlayed on top. You can use this solution to combine your HTML, PDF and HTML+PDF in any way you wish.
In fact, with HTML, this Javascript and a little customization you could have a document that was:
start document
format HTML div
format HTML div with this PDF background
format another HTML div
inject this entire PDF
format another HTML div with a different PDF background
inject a different entire PDF
...
end document

How to generate pdf file from dynamic data coming from mysql database in php?

I am doing one web application society management system. In this application I want to generate pdf file for each user separately. Means during invoice generation , if there are 10 users then for each user separate invoice should get generated as a pdf after clicking on generate PDF button. My invoice got generated for each user but now I dont understand how to convert it into pdf dynamically. So please help me in this question ?
Use any of the following php scripts to generate dynamic PDF documents
fpdf: http://www.fpdf.org/
tcpdf: http://www.tcpdf.org/
You probably have to check out this lib: mPDF
It's quite easy to use and allows you to generate PDF from HTML templates.

How to save a page as pdf in php

Does anyone know how I can save a page as pdf in php?
Example:
I have a page that is able to catch the users signature. Now I would like to create a button on the page that will convert the page into pdf so that the file can be saved to a folder.
Below you can see what the signature page looks like:
There are a number of PHP PDF API and tools which convert or wrap up html content including drawings, links and images etc.
A very good thread from StackOverflow :
Convert HTML to PDF using PHP
TCPDF can output PDF's from html: http://www.tcpdf.org/
If you need to use more advanced html you can use WKHTMLTOPDF: http://wkhtmltopdf.org/

Categories