Php 如何使用DOMPDF创建带有锚定标记的PDF

Php 如何使用DOMPDF创建带有锚定标记的PDF,php,dom,pdf-generation,anchor,dompdf,Php,Dom,Pdf Generation,Anchor,Dompdf,我试图在我的pdf中包含锚定标记,这是使用DOM 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:6

我试图在我的pdf中包含锚定标记,这是使用DOM 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();
$html=ob_get_clean();
$html='*{margin:0;padding:0}
';
$html.='';
$html.='';
$dompdf=新的dompdf();
$dompdf->load_html($html);
$dompdf->set_paper('letter','scanner');
$dompdf->render();
链接显示在生成的pdf中。但当我点击它时,什么都没有发生。我想在浏览器中打开链接。有什么建议吗?

这对我很有用:

<script type="text/php">
$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();

</script>

$html=ob_get_clean();
$html='*{margin:0;padding:0}
';
$html.='';
$html.='';
$dompdf=新的dompdf();
$dompdf->load_html($html);
$dompdf->set_paper('letter','scanner');
$dompdf->render();

DOM PDF默认的take-anchor标记。你可以看看例子是的。但我的代码有什么问题。为什么不工作?dompdf的哪个版本?什么PDF查看器?当PDF在iframe中时,我看到了类似的行为。可能是bug或查看器兼容性问题。您可能希望提交错误报告: