문제

I'm using html2pdf and I want to get rid of the top and left margins using css but I can't. Before output buffering margin is already set to 0, it works on html but when I convert it to pdf using html2pdf the top and left margins appears again.

Here's my current css.

body {
    margin: 0;
    padding: 0;
}

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

Please help.

도움이 되었습니까?

해결책

I suspect that the margins are generated by html2pdf, not from the html/css. Have you tried to set the margins in the html2pdf-constructor?
E.g. with array(0, 0, 0, 0) as last parameter:

$html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(0, 0, 0, 0));
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top