mPDF - Firefox PDF查看器中的背景图像质量差

问题描述 投票:6回答:2

我在body标签上创建了一个PDF(使用php库mPDF)和全尺寸背景图像:

body {
    background: url("..path/to/bg.jpg") center no-repeat;
    background-size: cover;
    background-image-resize: 6;
    background-image-resolution: 300dpi;
}

它在chromes,IE和acrobats pdf viewer中看起来很好,但在FF中可怕:

知道如何为Firefox处理这个问题吗?我使用CSS,使用宽度和高度,不同的分辨率,嵌入为.svg,但没有成功。

firefox mpdf
2个回答
12
投票

它是由Firefox的pdf.js中的一个错误引起的,当用HTML源上的background: no-repeat从mpdf生成PDF文件时就会出现这个错误。

作为解决方法,删除no-repeat属性可避免该错误。


0
投票

找到文件mpdf.php

改变$this->_out(sprintf('/YStep %d',99999));

$this->_out(sprintf('/YStep %d', 1024));

$this->_out(sprintf('/XStep %d',99999));

$this->_out(sprintf('/XStep %d', 1024));

这些变化确实对我有用

© www.soinside.com 2019 - 2024. All rights reserved.