How to get rid of left and top margins in css when using html2pdf

I am using html2pdf and I want to get rid of the top and left margins with css, but I cannot. Before the output buffering marker is already set to 0, it works on html, but when I convert it to pdf using html2pdf , the top and left margins appear again.

Here is my current css.

body { margin: 0; padding: 0; } #box { margin: 0; padding: 0; width: 803px; height: 1400px; border: 1px solid #000; } 

Please, help.

+4
source share
1 answer

I suspect that the fields are generated by html2pdf and not from html / css. Have you tried setting the fields in html2pdf-constructor ?
For instance. with array(0, 0, 0, 0) as the last parameter:

 $html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(0, 0, 0, 0)); 
+12
source

Source: https://habr.com/ru/post/1389795/


All Articles