P
P
p4s8x2013-08-11 00:52:16
PHP
p4s8x, 2013-08-11 00:52:16

HTML to JPG conversion

I must say right away that this is not about screenshots of sites, although the solution will probably work for this as well.

It is required to generate a sufficiently large number of images from small pieces of html.

What ideas came to mind:
1) Install a webkit thread on the server and generate it with it
2) Install mPDF or TCPDF to convert html to pdf, then convert to jpg using ImageMagick

In the first case, I don’t like the need to install additional software, it turns out quite a platform-dependent solution.
In the second, performance will most likely suffer.

Can anyone come across and have some simple solution? Ideally, some analogue of mPDF would be suitable, only in JPG

Answer the question

In order to leave comments, you need to log in

4 answer(s)
K
kxyu, 2013-08-11
@p4s8x

phantomJS

S
Sergey, 2013-08-11
Protko @Fesor

Of the ready-made solutions, there is also wkhtmltoimage - cross-platform. Used on several projects - quite a handy utility. I only recommend processing through a queue.

E
epicfailguy93, 2013-08-11
@epicfailguy93

I can suggest using Qt Webkit : pass your code to a QString , then get the image in a QPixmap and save it , it seems quite simple.

S
Sergey Cherepanov, 2013-08-11
@fear86

The second option is even worse in that the result of rendering html will not match the browser version. HTML support is quite limited there.
ps: IMHO if you need maximum quality, then webkit is the best option.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question