--print-media-type all images not displayed

Author: RahabibCreated Dec 11, 2022Updated Dec 23, 2022

wkhtmltopdf version(s) affected: wkhtmltopdf 0.12.6 (with patched qt)

OS information OSX 12.6.1

Description when using @media print styles with the flag --print-media-type, all other css loads etc. but all my images do not display in the pdf. If I remove this flag, the images work again. I use @media print to set chapter breaks to new pages etc.

How to reproduce wkhtmltopdf --print-media-type --enable-local-file-access compiled.html compiled_wkhtml.pdf - no images wkhtmltopdf --enable-local-file-access compiled.html compiled_wkhtml.pdf - images but now my chapter breaks are not loaded

css:

@media print {
    h1 {
        page-break-before: always;
    }
    .new-page, .pagebreak, .page-break {
        page-break-before: always;
    }
    blockquote{
        page-break-inside: avoid;
    }
    table {
        page-break-inside: avoid;
    }
    .keep-together {
        page-break-inside: avoid;
    }
    img { /* added as experiment */
        display: block !important;
    }
}

Expected behavior images should be displayed on pdf

Possible Solution
This looks like a css rendering issue. happy to hack css further if needed.