Print / Save as PDF (save CSS layout)

When I just print (like on paper) or save as a PDF page (using the browser tool built in), css is completely ignored, and I just get ugly lines after the content lines!

Is there any way to do this (without having to convert HTML 2 to PDF / image)?

Thanks!

+4
source share
2 answers

You should look for media types in CSS ... set one to print, and you should be good to go. I found that this page is really useful.

+1
source

You probably have the media option.

 <!-- will ignore css on print --> <link href="style.css" rel="stylesheet" type="text/css" media="screen" /> <!-- will only use css when printing --> <link href="style.css" rel="stylesheet" type="text/css" media="print" /> <!-- will use both --> <link href="style.css" rel="stylesheet" type="text/css" /> 
+1
source

Source: https://habr.com/ru/post/1493059/


All Articles