Php PDF链接应在mPDF库的新选项卡中打开
我想在新选项卡中打开嵌入在pdf中的链接。我正在使用Drupal中的mPDF库生成pdf。Php PDF链接应在mPDF库的新选项卡中打开,php,html,drupal-7,mpdf,Php,Html,Drupal 7,Mpdf,我想在新选项卡中打开嵌入在pdf中的链接。我正在使用Drupal中的mPDF库生成pdf。我尝试了target=“\u blank”,但它不起作用。这就是我实际使用的代码 <tr><td><a target="_blank" style="color: #fff; text-decoration: none;" href="'.$course_url.'">' . $coursecertfiltered . '</a></td><
我尝试了target=“\u blank”,但它不起作用。这就是我实际使用的代码
<tr><td><a target="_blank" style="color: #fff; text-decoration: none;" href="'.$course_url.'">' . $coursecertfiltered . '</a></td></tr>
如果对Javascript有信心,您可以尝试:
<a onclick="openInNewTab('path-to-pdf-file');">Open in a new Tab</a>
<script>
function openInNewTab(url) {
var win = window.open(url, '_blank');
win.focus();
}
</script>
在新选项卡中打开
函数openInNewTab(url){
var win=window.open(url,“_blank”);
win.focus();
}
您使用的确切代码是什么请查找有问题的代码,刚才我编辑了我认为PDF不支持指定目标。请在标记的和处指定target=“\u blank”。。这可能适用于动态pdf。这样地: