Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

142
Vistas
Hide Google Ads while printing the page

I am trying to use window.print to print a single image on my page.

That's the image user is interested to print.

Before putting ads on my website everything was working fine but after starting adsense ads while printing the page the print preview page shows the ads too.

How can i hide them ?

before i hide all the elements by css code which looks like below but now as i won't be able to know how and where an ad is placed as ad is auto.

@media print {
    @page {
        margin: 0;
        margin-top: 10px;
    }
    nav, header, .cardButtonRow, #about, .toastContainer, footer, .adsbygoogle, .google-auto-placed {
        display: none;
    }
    .cardImage img {
        width: 82%;
        box-shadow: none;
    }
} 

The page structre mostly

<body>
<nav>....</nav>
<article class="container cardContainer">


        <header>
            <h1>Your eCard is Ready to Print</h1>
            <p>Save it or Print it !</p>
        </header>

        <div class="cardImage">
            <img alt="">
        </div>

        <div class="cardButtonRow">
            <a class="button" onclick="printClick();">Print Card</a>
            <a class="button">Download</a>
        </div>

...
<footer>...</footer>
</body> 

How to print only the image ?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

How about something like this:

@media print {
    @page {
        margin: 0;
        margin-top: 10px;
    }
    * {
        display: none !important;
    }
    html, body, article, .cardImage, .cardImage img {
        display: block !important;
    }
    .cardImage img {
        width: 82%;
        box-shadow: none;
    }
}

Hide everything, then un-hide the image and its ancestors.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda