M
M
Maxxdev2017-10-29 12:13:59
PHP
Maxxdev, 2017-10-29 12:13:59

How to approach the implementation of PSD->HTML->PDF->image or PSD->HTML->image->PDF in PHP?

There is a set of PSD templates with reports containing graphs.
At the output, you need to get PDFs and pictures, i.e. the user can specify in the personal account in which format reports should be received. The implementation must be in php.
Now implemented like this:

  1. The coder made up the HTML
  2. The script converts HTML to PDF using mPDF
  3. Script convert PDF to png image using Imagick

This option does not look optimal and there are a number of difficulties when converting to PDF (lack of support for many tags, etc.)
Perhaps the best option would be such a sequence -
PSD->HTML->image->PDF, but it is not clear how to convert HTML to image , advise?
Or make up a PSD to SVG and then use Imagick to convert it to an image and then to PDF, what are the pitfalls?
What can you recommend?
Thank you.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dimonchik, 2017-10-29
@Maxxdev

a picture in PDF remains a picture
see https://wkhtmltopdf.org/ for html to pdf and its wrapper

A
Alexander Taratin, 2017-10-29
@Taraflex

https://wkhtmltopdf.org/ can immediately both in pdf and in a picture

P
Pretor DH, 2017-10-29
@PretorDH

If you convert a page first into an image, then there is no point in converting it to PDF !!!
This, for example: will result in the combination of text into an image, which will greatly reduce the print quality of the finished PDF and destroy the user's ability to copy text.
Therefore, I do not see any problems in your concept. But in general it is better wkhtmltopdf.org I
recommend only to make a style sheet for printing. And PDF, which is similar in style to the CSS table for printing the page, is what you need to include when exporting to PDF.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question