简体   繁体   中英

Is there a way to hide html element when printing a PDF

I want to hide "View Details" anchor tag from PDF when it gets print. Is the are a way to hide html element from PDF when printing. Iam using DOMPDF laravel package from generating pdf's i got a solution https://www.w3schools.com/jsref/event_onafterprint.aspbut not working in my case.

**@media print {
       // Hide unwanted HTML:
       …
    }**

the above given code snippet is also not working.

Use a 'Print Stylesheet'.

Just a few CSS rules and you're done:

@media print {
   // Hide unwanted HTML:
   …
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM