I have a little issue if I print images with Chrome or Firefox. I haven't found how to get rid of white borders in portrait or landscape. This stackoverflow-solution seems to not works for me sadly.
Currently I use this code:
    echo "<body onload=\"window.print()\" onfocus=\"window.close()\">";
    echo "<style type=\"text/css\" media=\"print\">";
    echo "@page { size: auto; }";
    echo "</style>";
    echo "<img src=\"". $dirname . '/' . $photo ."\">";
I get the same result as drag and drop it from windows folder to internet navigator like this exemple:
Chrome is set as: - Landscape - Colors - A4 - Marges none

try to apply the container css :
@page {
  size: A4;
  margin: 0;
}
@media print {
  html, body {
    width: 210mm;
    height: 297mm;
  }
}
then instead of using img tag use background image + size cover
body {
    background-image:  url(images/background.svg);
    background-size:   cover;                      /* <------ */
    background-repeat: no-repeat;
    background-position: center center;            /* optionally, center the image */
}
source:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With