MPDF full page background

后端 未结 3 1658
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-02 16:32

I spent way too much time on this and I can\'t figure out a good 21th century solution.

Simply I have to generate a business card in PDF with a background image, but MPD

3条回答
  •  没有蜡笔的小新
    2021-02-02 16:43

    mPDF has a custom css property for background images: background-image-resize with custom values from 0-6:

    • 0 - No resizing (default)
    • 1 - Shrink-to-fit w (keep aspect ratio)
    • 2 - Shrink-to-fit h (keep aspect ratio)
    • 3 - Shrink-to-fit w and/or h (keep aspect ratio)
    • 4 - Resize-to-fit w (keep aspect ratio)
    • 5 - Resize-to-fit h (keep aspect ratio)
    • 6 - Resize-to-fit w and h

    So you probably need: body {background-image:url(something.png); background-image-resize:6}

    Taken from mPDF docs

提交回复
热议问题