CSS formatting does not apply in HTML2PDF plugin

Asked

Viewed 89 times

0

I’m using the plugin html2pdf, but when trying to use formatting CSS:

table { line-height: 10px }

The same is not applied, I found nothing in the plugin documentation, someone knows how to fix it?

Example of what makes the CSS "table { line-height: 10px }"

table { line-height: 10px }
<table style="width:100%">
  <tr>
    <th>Firstname</th>
    <th>Lastname</th>
    <th>Age</th>
  </tr>
  <tr>
    <td>Jill</td>
    <td>Smith</td>
    <td>50</td>
  </tr>
  <tr>
    <td>Eve</td>
    <td>Jackson</td>
    <td>94</td>
  </tr>
</table>

1 answer

0

Actually html2pdf has several limitations regarding the use of css, you can really check if it is the case of one of these limitations, then your options would be:

  • Create an Issue on official repository of the project;

  • If it is urgent, create a project Fork and identify and resolve the problem (do not forget to create a Pull-request in the original project if you get hehe);

  • Testing a solution with Javascript, using pdf.js and html2canvas, as described above in that matter.

I hope I’ve been of some help :)

  • Yes, I thought about the third option, but the way the programming was made seems to me not accept javascript, only php, then I will have to do a hell of a Gambi, I will try to do with javascript, if I can’t, I will have to appeal to the second option even :|

Browser other questions tagged

You are not signed in. Login or sign up in order to post.