简体   繁体   English

我的网站在打印时会缩放,使黑色文本看起来是灰色的

[英]My website scales when printed, making black text look grey

I have a completely fluid website that is designed primarily for printing.我有一个完全流畅的网站,主要用于打印。 It stretches beautifully to any window or paper size:它可以完美地延伸到任何窗口或纸张尺寸:

body { width: 100%; }

However, for printed pages, some of my black lines and text become grey and I have 1px lines that don't print as solid lines, but more of a fuzzy grey dotted line.但是,对于打印的页面,我的一些黑线和文本会变成灰色,并且我有1px线不会打印为实线,而是更多的模糊灰色虚线。 This seems to be because browsers are scaling the page on print, like the "Shrink To Fit" of IE.这似乎是因为浏览器在打印时缩放页面,就像 IE 的“缩小以适应”一样。

So I see two options.所以我看到两个选项。

  1. Specify line widths and font sizes using css units that work well on print, potentially fighting against browsers in-built mechanisms to make pages print well when everything is specified in pixels.使用适合打印的 css 单位指定线宽和字体大小,这可能会与浏览器的内置机制作斗争,以便在以像素为单位指定所有内容时使页面打印良好。 This question works at part of that without much success. 这个问题在没有多大成功的情况下部分起作用。

  2. Find the body width ( 8.5in ? 7.5in ? 90% ? 800px ?) which makes lines solid and text black for 8.5 inch wide paper.找到使 8.5 英寸宽纸张的线条为实线和文本为黑色的body宽度( 8.5in ? 7.5in ? 90% ? 800px ?)。

Which approach is likely to be successful?哪种方法可能成功?

You might consider using a separate stylesheet for print media, or perhaps just override offending styles with a @media print { /* rules here */} block at the end of your current stylesheet.您可能会考虑为印刷媒体使用单独的样式表,或者可能只是在当前样式表的末尾使用@media print { /* rules here */}块覆盖有问题的样式。

If you are designing a website for both screen and print, this will give you the most flexible way to independently control styling for both media.如果您正在为屏幕和印刷设计一个网站,这将为您提供最灵活的方式来独立控制两种媒体的样式。

It could be an issue with the printer quality.可能是打印机质量问题。 1px rendered in hi-res looks a bit different when it comes out of a 5 year old printer with print quality set to "fast draft".当打印质量设置为“快速草稿”的 5 岁打印机输出时,以高分辨率呈现的 1px 看起来有点不同。

Two easy troubleshooting options to try:可以尝试两个简单的故障排除选项:

  1. Either increase the print quality and print in full color, or try it from a different printer.要么提高打印质量并以全色打印,要么尝试使用其他打印机。

  2. If it's possible, perhaps you could try to thicken the lines a bit?如果可能的话,也许您可​​以尝试将线条加粗一些? I know it may not work with your design, but sometimes the simplest answers are best.我知道它可能不适用于您的设计,但有时最简单的答案是最好的。

Good luck man.祝你好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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