Php 设置为css字体,仅在第一页呈现,后续为Times ne Roman(mpdf)

Php 设置为css字体,仅在第一页呈现,后续为Times ne Roman(mpdf),php,wordpress,mpdf,html2pdf,Php,Wordpress,Mpdf,Html2pdf,在css中,我将font-family设置为font-family:DejaVu-Sans,它只在生成的PDF的第一页上工作,随后的页面是Times New-Roman PHP 7.2.24/ubuntu mPdf 8.0 在本地(窗口)上,所有工作正常 $html = " <!DOCTYPE html> <html> <head> <meta http-equiv='Content-Type'

在css中,我将font-family设置为font-family:DejaVu-Sans,它只在生成的PDF的第一页上工作,随后的页面是Times New-Roman

PHP 7.2.24/ubuntu mPdf 8.0

在本地(窗口)上,所有工作正常

  $html = "
    <!DOCTYPE html>
    <html>
      <head>
        <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
        <style  type=\'text/css\'> html { margin-top: 70px} p,ul,ol{font-size:14px!important;} h2{font-size:20px!important; margin-bottom: 10px!important;} h3{font-size:16px!important;} figcaption{font-size:12px!important;} figure{text-align: center;} img{max-width: 500px;}
          .section-newsletter,.wp-block-share-quote-share-quote-block, .acf-section-conversion, { opacity:0;}
          header { width:100%; text-align: center;}
          body{font-family: DejaVu Sans; sans-serif; font-weight: normal;}
        </style>
      </head>
      <body>
 ";
  $html .= "<h1 style='text-align: center; font-weight: bold;'> $post->post_title </h1>";
  $html .= '<article>' . $post->post_content . '</article>';
  $html .= "</body></html>";

  $mpdf = new \Mpdf\Mpdf([
    'format' => 'A4-P',
    'margin_top' => 25,
    'margin_header' => 10,
    'margin_bottom' => 25,
  ]);

  $mpdf->SetHTMLHeader("
  <div style='text-align: right; font-weight: bold;'>
  <header><a href='https://www.com'><img style='display:inline-block;' src='https://www.com/wp-content/themes/theme/resources/images/logo.svg' alt='www logo'></a></header>
  </div>");
  $Htmltemp = str_replace('https://www.com/wp-content/uploads/', 'wp-content/uploads/', $html);
  $mpdf->SetAuthor("XYZ");
  
);
$mpdf->SetFooter($footer);

  $mpdf->WriteHTML($Htmltemp);

  $mpdf->Output($url . '/pdfs/' . $postIdMd . '.pdf', 'F');
}
$html=”
html{页边距顶部:70px}p,ul,ol{字体大小:14px!重要;}h2{字体大小:20px!重要;页边距底部:10px!重要;}h3{字体大小:16px!重要;}figcaption{字体大小:12px!重要;}图形{文本对齐:中心;}img{最大宽度:500px;}
.section新闻稿、.wp块共享块、.acf节转换,{opacity:0;}
标题{宽度:100%;文本对齐:居中;}
正文{字体系列:DejaVu Sans;无衬线;字体重量:正常;}
";
$html.=“$post->post_title”;
$html.='
");
$Htmltemp=str\u替换('https://www.com/wp-content/uploads/“,”wp content/uploads/“,$html);
$mpdf->SetAuthor(“XYZ”);
);
$mpdf->SetFooter($footer);
$mpdf->WriteHTML($Htmltemp);
$mpdf->Output($url.'/pdfs/'.$postedmd..pdf.'F');
}