2017-07-12 47 views
0

此输出运行良好的HTML/PHP:从PHP = ok输出,来自DOMPDF =错误。 (显示器)

<?xml version="1.0" encoding="utf-8"?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es"> 
<head> 
<title>(PAbi)</title> 
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> 
<link rel="icon" href="https://cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico" type="image/x-icon" /> 
<link rel="shortcut icon" href="https://cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico" type="image/x-icon" /> 
<style type="text/css">html,body{margin:0;padding:0;background:#000;color:#fff;font-family:helvetica;} 
.pie{position:fixed;width:100%;bottom:0;color:#000;background:#fff9f2;font-size:6.5pt;text-align:center;border-top:1px dashed #aa0000;} 
#indice{width:430px;margin:auto;} 
#indice dt{float:left;width:300px;overflow:hidden;white-space:nowrap;} 
#indice dd{margin:0;float:left;width:100px;overflow:hidden;} 
#indice dt span:after{content:".....................................................";} 
</style></head> 
<body><div id="cosmos"><br /> 
<h1 class="marin">index</h1> 
<ul id="indice"> 
<dt><span>Índice</span></dt><dd>2</dd> 
<dt><span>intro</span></dt><dd>3</dd> 
<dt><span>functions</span></dt><dd>4</dd> 
</ul></div> 
<div class="pie">Aliens is here</div> 
</body></html> 

正如你所看到的,我需要创建索引页面,然后我需要这个“doits”,我从得到这个代码:

CSS Justify text, fill space with dots

但是,当我导出为PDF格式与DOMPDF,显示器不好走......

感谢任何帮助,我可以创建在网页“指数”采用doits到的网页数?谢谢!

回答

0

关心朋友。

使用这个代码,我可以 “创造” 我 “页面索引” 使用:

  • XHTML
  • DOMPDF
  • 与 “doits” 显示页码

问题

  • 指数信息是当你从CSS使用[标签:后{内容:“...你的字符串在这里...”;}]] DOMPDF永远放一个换行符,然后显示“页索引”在文档PDF中是错误的。

    也许任何人想要使用此选项...

    <?php 
    // I put excesive doits only by do test xD 
        $puntos = str_repeat('.', 999); 
    
        echo '<?xml version="1.0" encoding="utf-8"?> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es"> 
    <head><title>(PAbi)</title> 
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> 
    <link rel="icon" href="https://cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico" type="image/x-icon" /> 
    <link rel="shortcut icon" href="https://cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico" type="image/x-icon" /> 
    <style type="text/css"> 
    table{width:650px;border-spacing:0.5em;} 
    #indice1 td{overflow:hidden;max-width:400px;border-radius:2em;padding:0.3em;} 
    #indice1 span:after{content:"'.$puntos.'";} 
    .numpa{text-align:center;width:20px;background:#d3dbfa;border:1px solid #000;} 
    .info{width:205px;background:#d1f6a5;border:1px solid #000;} 
    </style></head><body> 
    <table id="indice1"><tr> 
    <td class="info">ÍNDICE</td> 
    <td class="puntos"><span></span></td> 
    <td class="numpa">2</td></tr><tr> 
    <td class="info">Introducción</td> 
    <td class="puntos"><span></span></td> 
    <td class="numpa">3</td></tr><tr> 
    <td class="info">Características del servicio</td> 
    <td class="puntos"><span></span></td> 
    <td class="numpa">4</td> 
    </tr></table></body></html>'; 
    ?> 
    
  • 0

    不幸的是DOMPDF(当前版本是v0.8.0)无法处理特定的造型。主要问题是Dompdf没有正确地重新排列队列末尾的浮点数。但即使您使用类似#indice dd + dt { clear: both; }的东西来强制它,Dompdf也没有适当地清除浮动,并继续将浮动附加浮动写入同一行。