问题描述
简单的
$pdf->writeHTML("<hr>",true,false,'');
上次测试时确实有效(TCPDF 的几个版本之前),现在导致“未定义索引:样式”。
来自TCPDF源的相关代码是
case 'hr': {
if ((isset($tag['height'])) AND ($tag['height'] != '')) {
$hrHeight = $this->getHTMLUnitToUnits($tag['height'],1,'px');
} else {
$hrHeight = $this->GetLineWidth();
}
$this->addHTMLVertSpace($hbz,max($hb,($hrHeight / 2)),$cell,$firsttag);
$x = $this->GetX();
$y = $this->GetY();
$wtmp = $this->w - $this->lMargin - $this->rMargin;
if ($cell) {
$wtmp -= ($this->cell_padding['L'] + $this->cell_padding['R']);
}
if ((isset($tag['width'])) AND ($tag['width'] != '')) {
$hrWidth = $this->getHTMLUnitToUnits($tag['width'],$wtmp,'px');
} else {
$hrWidth = $wtmp;
}
$prevlinewidth = $this->GetLineWidth();
$this->SetLineWidth($hrHeight);
$lineStyle = array(
'color' => $tag['fgcolor'],'cap' => $tag['style']['cap'],// Error thrown here.
'join' => $tag['style']['join'],'dash' => $tag['style']['dash'],'phase' => $tag['style']['phase'],);
$lineStyle = array_filter($lineStyle);
$this->Line($x,$y,$x + $hrWidth,$lineStyle);
$this->SetLineWidth($prevlinewidth);
$this->addHTMLVertSpace(max($hbc,!isset($dom[($key + 1)]));
break;
$tag
的值为
Array
(
[elkey] => 0
[tag] => 1
[value] => hr
[block] => 1
[opening] => 1
[parent] => 0
[self] => 1
[hide] =>
[fontname] => dejavusans
[fontstyle] =>
[fontsize] => 10
[font-stretch] => 100
[letter-spacing] => 0
[stroke] => 0
[fill] => 1
[clip] =>
[line-height] => 1.25
[bgcolor] =>
[fgcolor] => Array
(
[R] => 0
[G] => 0
[B] => 0
)
[strokecolor] => Array
(
[R] => 0
[G] => 0
[B] => 0
)
[align] =>
[listtype] =>
[text-indent] => 0
[text-transform] =>
[border] => Array
(
)
[dir] => ltr
[attribute] => Array
(
)
)
可以看出,没有 style
键。我做错了什么,还是这是 TCPDF 中的错误?我该如何解决?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)