Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Speaking from personal experiences, I would say styling the output of <code>HTML2PDF</code> is, at best, esoteric black magic science. The main reasons for this are:</p> <ul> <li>The class only supports a (relatively small) subset of CSS styles &amp; selectors</li> <li>CSS compatibility is undocumented</li> <li>PDF is impossible to debug in relation to the HTML input</li> </ul> <p>To be fair, this is not only the issue for <code>HTML2PDF</code> but <a href="https://stackoverflow.com/a/3404236/216129">also for the <code>TCPDF</code> that <code>HTML2PDF</code> uses</a>.</p> <p>It <em>might</em> be possible that <code>HTML2PDF</code>, being just an almost-zero-setup, quick &amp; easy alternative interface for the <code>TCPDF</code>, cuts more CSS support off — but I'm sure that <strong>even <code>TCPDF</code> wouldn't support <code>float</code> properly</strong>.</p> <p>The best workaround that you could use is to send your floating divs to the nineties:</p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td&gt;&lt;div class="float"&gt; ... &lt;/div&gt;&lt;/td&gt; &lt;td&gt;&lt;div class="float"&gt; ... &lt;/div&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>You could also hide this embarrassment from the public HTML:</p> <pre><code>&lt;?php $isPdf = (/* condition that tells us we're outputting PDF */) ? true : false; if ($isPdf) { echo "&lt;table&gt;&lt;tr&gt;&lt;td&gt;"; } ?&gt; &lt;div class="float"&gt; ... &lt;/div&gt; &lt;?php if ($isPdf) { echo "&lt;/td&gt;&lt;td&gt;"; } ?&gt; &lt;div class="float"&gt; ... &lt;/div&gt; &lt;?php if ($isPdf) { echo "&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"; } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload