【发布时间】:2011-03-16 13:39:56
【问题描述】:
我正在使用 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();
?>
有人遇到同样的问题吗?它看起来像一个随机错误,我无法弄清楚原因。提前感谢您的所有帮助
【问题讨论】:
-
您好,“锐利”是什么意思?你能不能给两份PDF:一份可以,一份不可以。
-
图像边缘锐利。我现在没有一个锐器,因为我无法复制它。它只是随机发生的,我一拿到就会上传给你