Zunenonooo / dompdf

Automatically exported from code.google.com/p/dompdf
0 stars 0 forks source link

Simple HTML with inline CSS doesn't respect the 'TOP' property #535

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I used the following php code to render some HTML into a PDF, expecting to have 
the text on top of the image.  When I echo out the html it looks exactly as I 
expect it to.  When I convert it into a pdf, the text is in its default x and y 
position.

I'm using PHP 5.2, and I don't know how to check my DOMPDF file.  The php code 
is running on a CentOS virtual box.

ob_start(); //Turn on output buffering 
    ?>
    <html>
    <div class='container'>
        <p class='userName'>Joe Bob</p>
        <p class='courseName'>Super Awesome Course</p>
        <img src='the-image-source' />
    </div>
    <style type="text/css">
    .container {
        position:relative;
    }
    .userName {
        position: absolute;
        top: 207px;
        left: 204px;
        font-size: 43px;
        width: 869px;
        text-align: center;
        white-space: nowrap;
    }
    .courseName {
        position: absolute;
        top: 303px;
        left: 303px;
        font-size: 24px;
        width: 617px;
        text-align: center;
        white-space: nowrap;
    }
    </style>
    </html>
    <?php
    require_once("dompdf/dompdf_config.inc.php");
    $html = ob_get_clean(); 
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->render();
    echo $html;
    return $dompdf->output();

Original issue reported on code.google.com by jeremy.p...@rtraction.com on 21 Sep 2012 at 9:55

GoogleCodeExporter commented 8 years ago
Absolute positioning is not available if using 0.5.x. The feature has been 
added to the 0.6.x code base and we recommend updating to the latest available 
code if possible. 0.6.0 is currently in beta.

Original comment by eclecticgeek on 24 Sep 2012 at 3:16

GoogleCodeExporter commented 8 years ago

Original comment by eclecticgeek on 30 May 2013 at 5:16