【发布时间】:2014-11-23 12:09:28
【问题描述】:
我正在尝试在使用 DOM PDF 库创建的 pdf 中包含锚标记。下面是代码
$html = ob_get_clean();
$html = '<!DOCTYPE html><html><head><style> *{margin:0;padding:0} </style></head>
<body style="font-family: Helvetica; background:#fff; width:692pt; height:712pt;">';
$html .= '<a href="http://www.google.com" target="_blank">Click for Google</a>';
$html .= '</body></html>';
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->set_paper('letter', 'landscape');
$dompdf->render();
链接显示在生成的 pdf 中。但是当我点击它时,什么也没有发生。我想在浏览器中打开链接。有什么建议吗?
【问题讨论】:
-
DOM PDF 默认采用锚标记。您可以查看示例pxd.me/dompdf/www/examples.php#css_position_fixed.html,pdf
-
是的。但是我的代码有什么问题。为什么它不起作用?
-
什么版本的 dompdf?什么PDF查看器?当 PDF 在 iframe 中时,我看到了类似的行为。可能是错误或查看器兼容性问题。您可能需要提交错误报告:github.com/dompdf/dompdf/issues/new
标签: php dom pdf-generation anchor dompdf