 <p>You can use <strong>svg</strong> in <strong>img</strong> tag and append via jquery like below snippet I hope helps and It is working fine for <strong>print</strong> on <strong>Chrome</strong> and <strong>FF</strong> browser. </p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function(){ var squareBox = 3000; //You can increase and descrease of square boxes for (var i = 1; i &lt;= squareBox; i++) { $('#test').append('&lt;img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMCIgaGVpZ2h0PSIxMCI+CjxyZWN0IHdpZHRoPSIxMCIgaGVpZ2h0PSIxMCIgZmlsbD0iI2ZmZiI+PC9yZWN0Pgo8cmVjdCB3aWR0aD0iNSIgaGVpZ2h0PSI1IiBmaWxsPSIjY2NjIj48L3JlY3Q+Cjwvc3ZnPg=="&gt;'); } })</code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>#test{ height: 500px; width: 500px; overflow: hidden; } #test img{ width: 10px; height: 10px; display: block; float: left; margin-top: 0px; } @media print and (color){ *{ -webkit-print-color-adjust: exact; print-color-adjust: exact; } button{display: none;} }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt; &lt;button type="button" onclick="window.print();"&gt;Print&lt;/button&gt; &lt;div id="test"&gt;&lt;/div&gt;</code></pre> </div> </div> </p>