Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k 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 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...