Php 为什么dompdf不承认;“目标”;HTML代码中的属性?

Php 为什么dompdf不承认;“目标”;HTML代码中的属性?,php,html,dompdf,Php,Html,Dompdf,为什么dompdf不能识别target=“\u blank”属性?我能做些什么来让它工作?我还尝试了target=“\u tab”。这是我的代码: <?php error_reporting(0); ini_set("gd.jpeg_ignore_warning", 1); set_include_path(get_include_path() . PATH_SEPARATOR . "dompdf"); require_once('dompdf/dompdf_config.in

为什么dompdf不能识别
target=“\u blank
”属性?我能做些什么来让它工作?我还尝试了
target=“\u tab”
。这是我的代码:

  <?php
    error_reporting(0); ini_set("gd.jpeg_ignore_warning", 1); set_include_path(get_include_path() . PATH_SEPARATOR . "dompdf"); require_once('dompdf/dompdf_config.inc.php');
    $fk_marca = $_GET['id'];$fk_familia = $_GET['m'];$session = $_GET['session'];
    $img_url = $_GET['img_url'];$titleCategoria = $_GET['title'];$nr_of_lines = $_GET['nr_of_lines'];
    $dompdf = new DOMPDF();
    $img  = "background-image:url('http://acros.netlogiq.info/dompdf/img/pic.png');background-repeat:no-repeat;";
    $img2 = "background-image:url('http://acros.netlogiq.info/dompdf/img/pic2.png');";
    $img3 = "background-image:url('http://acros.netlogiq.info/dompdf/img/Dungi6.png');background-repeat:no-repeat;";
    $header = '<div id="imageHeader" style="'.$img3.';width:1000px;">
                <div style="width:400px;">
                    <p style="margin-left:80px;font-weight:bold;padding-top:30px;font-family: \'Trebuchet MS\', \'Lucida Grande\', \'Lucida Sans Unicode\', \'Lucida Sans\', Tahoma, sans-serif;">MANUAL T&Eacute;CNICO</p>
                    <p style="margin-left:80px;padding-top:-8px;font-weight:bold;font-family: \'Trebuchet MS\', \'Lucida Grande\', \'Lucida Sans Unicode\', \'Lucida Sans\', Tahoma, sans-serif;">FAMILIA:<span>&nbsp;&nbsp;&nbsp;</span>'.$titleCategoria.'</p>
                </div>
                    <img  style="margin-left:700px;margin-top:-110px;" src ="http://acros.netlogiq.info/'.$img_url.'">
                    <div style="margin-left:725px;width:15px;margin-top:-20px;background-color:white;font-weight:bold;"><span class="pagenum">&nbsp;</span></div>
            </div></div><br><br><br><br>';
    $link = mysql_connect('localhost', 'netlogiq_attin', 'attin');
    $db = mysql_select_db("netlogiq_acros");
    if ($fk_familia == 0 ){
        $and = "fk_familia ='$fk_marca' ";
    }else{
        $and = "fk_marca = '$fk_familia' and fk_familia = '$fk_marca'";
    }
    $query = "select articulo,descripcion,imagen,link,precio,codigo from prod_detalle where ".$and." ";
    $select = mysql_query($query);
    $count_query = mysql_num_rows($select);
    $count = 1;
    $html = '<html>
        <style>
           <style>
            @page { margin: 180px 50px; }
            #imageHeader { position: fixed; height: 120px; margin-left:-50px;margin-top:-50px;}    
            .pagenum:after { content: counter(page); }
        </style>'.$header.'<br><br> ';
    while ($row = mysql_fetch_array($select)){
        $url = $row['imagen'];
        $title = $row['articulo'];
        $file = 'txt/textarea.txt';
        $desc =  $row['descripcion'];
        $link =  $row['link'];
        $codigo = $row['codigo'];
        if (empty($session))
            $price = " ";
        else
        $price = "<div style='margin-left:420px;'><span style='color:red;font-size:22px;'><b>".$row['precio']."&euro;</b></span></div>";
        if (empty($link)){
            $link = '&nbsp;';
        }else{
            $link = '&nbsp;&nbsp;<a  target="_blank" href ="'.$link.'">Link Fabricante</a>';
        }
        file_put_contents($file, $desc);
        $handle = fopen($file, "r");
        if ($handle) {
            $text ="";$i = 1;
            while (($buffer = fgets($handle, 4096)) !== false) {
                if ($i <= 9 ){
                    if ($buffer !=""){
                        $text = $text.$buffer;
                    }
                }
                $i++;
            }
            fclose($handle);
        }
        $wh ="";
        list($width, $height, $type, $attr) = getimagesize("http://acros.netlogiq.info/fotos/".$url); // get image info
        $ratio = $width/$height;
        if( $ratio > 2) {
            $width = 170;
            $height = 200/$ratio;
            $wh = "width:".$width."px;height:".$height."px;margin-left:-30px;margin-top:40px;";
        }elseif($ratio > 1.4 && $ratio < 2){
            $width = 170;
            $height = 160/$ratio;
            $wh = "width:".$width."px;height:".$height."px;margin-left:-30px;margin-top:30px;";
        }elseif($ratio <= 1 && $ratio > 1.099){
            $width = 160;
            $height = 144/$ratio;
            $wh = "width:".$width."px;height:".$height."px;margin-left:-24px;margin-top:10px;";
        }elseif($ratio >= 1.099 && $ratio <= 1.4){
            $width = 170;
            $height = 160/$ratio;
            $wh = "width:".$width."px;height:".$height."px;margin-left:-30px;margin-top:10px;";
        }elseif ($ratio < 1  && $ratio > 0.72) {
            $width = 80;
            $height = 80;
            $wh = "width:".$width."px;height:".$height."px;margin-left:16px;margin-top:40px;";
        }elseif ($ratio <= 0.72) {
            $width = 70;
            $height = 80;
            $wh = "width:".$width."px;height:".$height."px;margin-left:16px;margin-top:40px;";
        }else{
            $width = 70;
            $height = 80;
            $wh = "width:".$width."px;height:".$height."px;margin-left:16px;margin-top:40px;";
        }
        if ($count != 1){
            if (($count - 1) % 4 == 0){
                $marginTop = "padding-top:-76px;";
            }else{
                $marginTop ="padding-top:0px;";
            }
        }
        $html .= ' <div style="'.$marginTop.'">
            <div style="float:left;margin-left:-50px;padding-left:90px;height:200px;'.$img.'">
                <img src = "http://acros.netlogiq.info/fotos/'.$url.'" style="'.$wh.'">
            </div>';
        $html.= '<div style="padding-left:300px;margin-left:-35px;width:500px;height:160px;padding-top:10px;'.$img2.'">
                <span style="color:#574595;font-family: \'Arial Rounded MT Bold\', \'Helvetica Rounded\', Arial, sans-serif;"><b style="">'.$codigo.' '.$title.' </b></span><br>
                '.$price.'
                <span style="font-size:12px;font-family: \'Trebuchet MS\', \'Lucida Grande\', \'Lucida Sans Unicode\', \'Lucida Sans\', Tahoma, sans-serif;">'.$text.'</span>
                </div><div style="clear:both"></div><br></div><div style="clear:both"></div>'.$link.'';
                    if ($count % 4 == 0){
                        if($count !=  $count_query){
                            $html.='<p style="page-break-before: always;"></p><br><br><br><br><br><br><br><br><br><br>';
                        }else{
                            $html.='';
                        }
                    }elseif(($count % 4 != 0) && ($count ==  $count_query)){
                            $html.=' ';
                    }
        $count ++;
    }
    $html .='</html>';
    $dompdf->load_html($html);
    $dompdf->render();
    $output = $dompdf->output();
    file_put_contents("pdf_generated/file.pdf", $output);
    header("Location: http://acros.netlogiq.info/pdf_generated/file.pdf");
?>

dompdf使用URI操作提供链接支持()。此操作不支持为链接提供目标窗口


很容易看出,在浏览器中查看PDF时,您可能希望使用此功能。PDF文档只是浏览器中的又一个选项卡/窗口。但是,如果您孤立地考虑PDF文档,那么缺少此功能是可以理解的。直接在计算机上打开的PDF文档将在应用程序中打开,单击任何URI链接将通过外部应用程序(web浏览器)加载。所以PDF规范对windows/tabs没有任何了解,尤其是dompdf当前针对的规范版本。

target
不是一个元素,它是一个标记的属性。请发布最终的html锚,而不是这个不完整的片段。target是一个html属性,它与PDF无关,在PDF文件中永远不会被考虑。