Specify hairline thickness in CSS for printing

后端 未结 6 1351
失恋的感觉
失恋的感觉 2021-02-01 23:56

If I have a print CSS styling an element with:

border:1px solid black;

or:

border:0.25pt solid black;

The lin

6条回答
  •  梦谈多话
    2021-02-02 00:39

    I found B.Martin's answer most useful. Here's what I can add to it:

    Theory

    Physically the width of a hair (hairwidth) is between 17 and 181 microns. That is 0.02 to 0.2 mm or 0.05 to 0.5 pt.

    So making lines narrower than 0.1pt doesn't make much sense since eye might not see them.

    CorelDraw's hairline is 0.23pt or 81 micron.

    Practice

    In fact, wkhtmltopdf tool is handy for creating thin lines. I've managed to acheive the following widths:

    • 0.1pt with zoom factor of 8
    • 0.2pt with zoom factor of 4 (which is more practical since a4 is zoomed to a common size a0 in this case)

    I didn't measure the real width of the line but it looks pretty much the same as 'hairline' of my CorelDraw.

    NB Changing the width from 0.1pt to 0.15pt (zoom=8) or from 0.2pt to 0.3pt (zoom=4) doesn't change the resulting line width, at least visually.

    So, what I've come with is:

    wkhtmltopdf -s A0 --zoom 4  
    

    gives a pretty A0-sized page which can be automatically scaled back to A4 when printing - no hairwidth lines are lost on this stage as well.

    Update: I've finally managed to measure it using an Acrobat plugin: original 0.3pt line after -s A0 --zoom 4 becomes 0.6pt on a0 (that is 0.15pt after downsizing) which is quite enough of a hairline for me.

提交回复
热议问题