Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mPDF - bad background-image quality in Firefox PDF viewer

Tags:

firefox

mpdf

I create a PDF (using php library mPDF) with a full size background image on the body tag:

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

It looks just fine in Chrome's, IE's and Acrobat's PDF viewers, but horrible in FF: enter image description here

Any idea how I can handle this for Firefox? I played with the CSS, using width and height, different resolutions, embedding as .svg, but to no success.

like image 761
xsonic Avatar asked Mar 27 '14 10:03

xsonic


1 Answers

It's caused by a bug in Firefox's pdf.js that manifests when PDF files were generated from mpdf with background: no-repeat on its HTML source.

As a work-around, removing the no-repeat property avoids the bug.

like image 86
That Brazilian Guy Avatar answered Nov 12 '22 12:11

That Brazilian Guy