0

I am using dompdf to generate a pdf file with php. I want to completely get rid of the margins on my PDF. All the searching I perform comes up with the solutions of either setting the margin of the body element or setting margin of @page.

So here is a simplified bit of html i am using to demonstrate my problem:

<!DOCTYPE HTML>
<html>
<head>
    <style>
        @page{ margin:0px; }

        body{ 
                margin:0px;
                background-color:yellow;
            }
    </style>
</head>

<body>
abc
</body>
</html>

I still get a margin in the resulting PDF as shown below.

enter image description here

Mike
  • 2,862
  • 10
  • 42
  • 55
  • Try also setting the margin for the HTML element to zero. (ref http://stackoverflow.com/q/11649052/264628) – BrianS Apr 05 '13 at 05:24
  • 1
    FYI, it looks like a parsing bug. dompdf drops the @page styling if there's not a space before the opening brace. – BrianS Apr 05 '13 at 05:37
  • Make that an answer Brian so that I can marked it as the solution. Thanks for your help. Edit: Nevermind I just saw that it was marked as duplicate. Which by the way is wrong as I clearly stated that I had searched and what I posted in my question was (as far as valid html goes) the same thing as any of the other solutions provided. – Mike Apr 05 '13 at 12:06
  • no worries, hopefully we'll be able to address this particular bug quickly. – BrianS Apr 05 '13 at 15:45

0 Answers0