Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

158
Visualizações
forcing black and white printing

I need to print the contents between two div tags. The printing is done fine, but somehow if the user checks the "Background Graphics" checkbox in the printing pop up then the background becomes blue which is the actual background color of the web page. Is it possible to force the user to print only in black and white or disable the "Background Graphics" checkbox from the pint pop up? Below is the image of the "Background Graphics" check box that I am talking about:

enter image description here

below is my code to do the printing:

<script>

        function printContent(el) {
               var restorepage = $('body').html();
               document.getElementById('<%=lblDateTime.ClientID %>').style.display = "block";
               document.getElementById('<%=lblDateTime.ClientID %>').innerHTML = new Date().toLocaleString();
       
               document.getElementById('<%=acrLogo.ClientID %>').style.display = "block";
               document.getElementById('<%=compName.ClientID %>').style.display = "block";
               var printcontent = $('#' + el).clone();
               printcontent.removeAttr('style');
                $('body').empty().html(printcontent);
                window.print();
                $('body').html(restorepage);
            }

</script>

I also tried putting this in the page:

 <style>
article {
  -webkit-print-color-adjust: exact;
  background: #222;
  color: #eee;
}

</style>

Below is my div tag:

<div>
 The contents needs to be printed. This is just a test.
</div>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Use grayscale filter on @media print:

-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
filter: grayscale(100%);

Like this:

@media print {
  body {
    -webkit-filter: grayscale(100%);
    -moz-filter: grayscale(100%);
    -ms-filter: grayscale(100%);
    filter: grayscale(100%);
  }
}
Print this!
<span style="color:red;">Red text</span> 
<button onclick="window.print()">Print</button>

It'll force it:

forced b/w printing

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda