Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.8k views
in Technique[技术] by (71.8m points)

pdf - mPDF does not show SVG image

I am trying to set a background for a page with mPDF (8.0.0). The problem is that mPDF does not show the image. With some images I get it working, with others not. Why?

Working Image: https://public.skyworx.io/file.svg

Not working Image: https://public.skyworx.io/firefox-logo.svg

<?php
require_once __DIR__ . '/vendor/autoload.php';

$pdfOptions = array(
    'mode' => 'utf-8',
    'format' => 'A4',
    'img_dpi' => 300,
    'dpi' => 300,
  'tempDir' => __DIR__ . '/tmp'
);
$pdf = new MpdfMpdf( $pdfOptions );

$pdf->SetDefaultBodyCSS('background', "url('https://public.skyworx.io/firefox-logo.svg')");
//$pdf->SetDefaultBodyCSS('background', "url('https://public.skyworx.io/file.svg')");
$pdf->SetDefaultBodyCSS('background-image-resize', 6);

$html = '';
$pdf->WriteHTML( $html, 2 );
$pdf->debug = true;
$pdf->showImageErrors = true;
$pdf->Output();

question from:https://stackoverflow.com/questions/65940399/mpdf-does-not-show-svg-image

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...