繁体   English   中英

来自PHP的输出=正常,来自DOMPDF的输出=错误。 (显示)

[英]output from PHP = ok, from DOMPDF = wrong. (display)

此输出在HTML / PHP中运行良好:

<?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对齐文本,用点填充空间

但是当我使用DOMPDF导出到PDF时,显示效果变差了。。。

感谢您的帮助,我可以使用对页面数的点数来创建页面“索引”吗?谢谢!

问候朋友。

使用此代码,我可以使用以下方法“创建”我的“页面索引”:

  • XHTML
  • DOMPDF
  • 带有“ doits”的索引信息以显示页码

问题是,当您从css [TAG:after {content:“ ...您的字符串在这里...”;}]中使用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>';
?>

不幸的是,Dompdf(当前版本为v0.8.0)无法处理该特定样式。 主要问题是Dompdf在该行的末尾没有正确地重排浮动。 但是,即使您使用#indice dd + dt { clear: both; } #indice dd + dt { clear: both; } Dompdf无法正确清除浮点数,而是继续将浮点数和其他浮点数写入同一行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM