0

I am having a dynamically generated HTML layout which I would like to mimic in a PDF report, but I am having trouble with the columns specification. Assume that the HTML looks like this:

+------------------------------------------------------+
|                                                      |
|                     SECTION 1                        |
|                                                      |
+------------------------+-----------------------------+
|                        |                             |
|       SECTION 2        |         SECTION 3           |
|                        |                             |
+------------------------+-----------------------------+
|                                                      |
|                     SECTION 4                        |
|                                                      |
+---------------+-------------------+------------------+
|               |                   |                  |
|   SECTION 5   |     SECTION 6     |    SECTION 7     |
|               |                   |                  |
+---------------+-------------------+------------------+ 

And the content of the resulting PDF should be arranged the same. Now, since I don't know the actual layout in advance, I am looping section by section and creating a column for every section. At this point, I am able to calculate the width of a column. The problem is, since everything is a column, everything is at the same row, and I would like to make a wrap, so the columns which add to 100% width take a separate row. Is there a way to implement this in makepdf, or should I take a different approach?

1 Answers1

0

I use wkhtmltopdf to render PDF's from HTML. If you want something that's really really close to exactly how the HTML will look, then I would most definitely go with wkhtmltopdf.

Paul Carlton
  • 2,785
  • 2
  • 24
  • 42
  • Thanks for the answer. As far as I can see, the wkhtmltopdf is a comand line, I need a client-side solution. – Milorad Filipović Feb 08 '16 at 21:32
  • Ah! Interesting! Yeah looks like you'll have to use maybe 2 tables? I was looking at http://bpampuch.github.io/pdfmake/playground.html and they have a lot of good examples in there. – Paul Carlton Feb 09 '16 at 01:11