DOMPDF фоновото изображение понякога изглежда остро

Използвам DOMPDF, за да създам сертификат, така че хората да могат да го отпечатат. Проблемът е, че фоновото изображение понякога изглежда остро. И това нещо понякога изглежда добре, понякога не и не съм сигурен защо.

Моят pdf html код е:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<style>
    @page {
     margin:0;
        padding:0;
    }

    body{
        margin:0;
        padding:0;
        width:841px;
        height:545px;
        font-family:Verdana;
            }
    #lol{
        width:841px;
        height:545px;
        background:url(30-Day-Goals-Certificate.jpg);
    background-repeat: no-repeat; 
    position:relative;
    }
    .eating{
        position: absolute;
        top: 355px;
        left: 425px;
        color: #02436d;
        font-size: 17px;
        font-weight: bold;
        font-family:"proxima";
    }
    .exercise{
        position: absolute;
        top: 387px;
        left: 455px;
        color: #02436d;
        font-size: 17px;
        font-weight: bold;
        font-family:"proxima";
    }
    .name{
        position: absolute;
        top: 220px;
        left: 275px;
        color: #237e2f;
        font-size: 42pt;
        font-weight: bold;
        font-family:"english";
    }
    .month_number{
        position: absolute;
        top: 172px;
        left: 571px;
        color: #02436d;
        font-size: 28pt;
        font-weight: bold;
        font-family:"lucida";
    }   
</style>
</head>
<body>



<body>
<div id="lol">
    <div  class="eating">10</div>
    <div  class="exercise">12</div>
    <div  class="name">Jhon Doe</div>
    <div  class="month_number">#4</div>
</div>  

</body>
</html>

Изображението може да бъде намерено на http://weightlosssuccessoholics.com/pdf/30-Day-Goals-Certificate.jpg

И моят код за генериране на pdf е:

<?php

require_once("dompdf_config.inc.php");
 ob_start();

require("pdf.php");
$dompdf = new DOMPDF();




$dompdf->load_html(ob_get_clean());
$dompdf->set_paper(array(0,0,629.00,410.00),'portrait');
$dompdf->render();



$dompdf->stream();
?>

Някой да се сблъсква със същия проблем? Изглежда като случайна грешка и не мога да разбера причината. Благодаря предварително за цялата ви помощ


person chifliiiii    schedule 16.03.2011    source източник
comment
Здравей, какво разбираш под остро? можете ли да дадете два PDF файла: един, когато е наред, и един, когато не е.   -  person Fabien Ménager    schedule 16.03.2011
comment
Остри ръбове на изображението. В момента нямам такъв, тъй като не мога да го възпроизведа. Просто се случва на случаен принцип, веднага щом получа такъв, ще го кача за вас   -  person chifliiiii    schedule 21.03.2011


Отговори (1)


можете да увеличите разделителната способност, като използвате следната променлива: def("DOMPDF_DPI", 96);

в dompdf_config.inc.php

/**
 * Image DPI setting
 *
 * This setting determines the default DPI setting for images and fonts.  The
 * DPI may be overridden for inline images by explictly setting the
 * image's width & height style attributes (i.e. if the image's native
 * width is 600 pixels and you specify the image's width as 72 points,
 * the image will have a DPI of 600 in the rendered PDF.  The DPI of
 * background images can not be overridden and is controlled entirely
 * via this parameter.
 *
 * For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI).
 * If a size in html is given as px (or without unit as image size),
 * this tells the corresponding size in pt.
 * This adjusts the relative sizes to be similar to the rendering of the
 * html page in a reference browser.
 *
 * In pdf, always 1 pt = 1/72 inch
 *
 * Rendering resolution of various browsers in px per inch:
 * Windows Firefox and Internet Explorer:
 *   SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:?
 * Linux Firefox:
 *   about:config *resolution: Default:96
 *   (xorg screen dimension in mm and Desktop font dpi settings are ignored)
 *
 * Take care about extra font/image zoom factor of browser.
 *
 * In images, <img> size in pixel attribute, img css style, are overriding
 * the real image dimension in px for rendering.
 */
person space_balls    schedule 21.04.2011