You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Jeremias Maerki <de...@jeremias-maerki.ch> on 2006/05/12 17:34:16 UTC

Line widths in PDF

Philippe Drix made me look into why his borders don't show up properly
in Acrobat Reader and his printer.

He specified border widths as 0.002cm: 0.002cm = 0.0567pt = 0.02mm 

At 600dpi one dot/pixel is 1/600in = 0.00166666in = 0.12pt = 0.0423mm

So the border is less than half a pixel wide at 600dpi which is the
nominal resolution for most laser printers today. Even at 1200dpi you
don't have a full pixel, yet. 

Digging into the source code, I found out: In FOP 0.20.5 horizontal and
vertical lines are painted as rectangles (0.056pt wide). In FOP 0.92beta
we're painting these lines as lines (0.056pt wide). So it appears that
Acrobat Reader handles the two differently. Apparently, it cannot be
said that FOP does something wrong per se. But the question pops up if
we should change the way we paint horizontal and vertical lines as part
of our border painting code.

There's another thing. PDF allows to specify "0" as line width which
should result in 1 pixel on the target device. From the PDF Reference:
"However, some devices cannot reproduce 1-pixel lines, and on
high-resolution devices, they are nearly invisible. Since the results of
rendering such “zero-width” lines are device-dependent, their use is not
recommended." It would also be questionable how exactly we would
determine when to use "0" as line width. Probably not the best of ideas.

WDYT?

Jeremias Maerki


Re: Line widths in PDF

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
If I understood Philippe correctly, he got that value from an OpenOffice
file. He said he'd try to change it. Anyway, despite this being a poor
use case, this is still something we should keep in sight. Even I have
seen strange effects of border painting inside Acrobat Reader because of
effects from anti-aliasing, for example, two border with the same width
but not displaying at the same width.

You're right. It's not a FOP bug, it's a glitch in Acrobat Reader but
always the easily reachable party is blamed. I have myself filed a bug
against Adobe Acrobat once before and never heard a word back. That's
life. :-)

On 15.05.2006 13:22:29 Chris Bowditch wrote:
> Jeremias Maerki wrote:
> 
> > Philippe Drix made me look into why his borders don't show up properly
> > in Acrobat Reader and his printer.
> > 
> > He specified border widths as 0.002cm: 0.002cm = 0.0567pt = 0.02mm 
> 
> :o I don't think this is a valid use case. Why would anyone want a 
> border so thin??? Just tell Philippe to widen his border to say 0.5pt. 
> Or provide a real world example of why such a thin border is required.
>
> > 
> > At 600dpi one dot/pixel is 1/600in = 0.00166666in = 0.12pt = 0.0423mm
> > 
> > So the border is less than half a pixel wide at 600dpi which is the
> > nominal resolution for most laser printers today. Even at 1200dpi you
> > don't have a full pixel, yet. 
> 
> Yes I know. Precisely why I don't think anything less than 0.5pt is a 
> valid use case.
> 
> > 
> > Digging into the source code, I found out: In FOP 0.20.5 horizontal and
> > vertical lines are painted as rectangles (0.056pt wide). In FOP 0.92beta
> > we're painting these lines as lines (0.056pt wide). So it appears that
> > Acrobat Reader handles the two differently. Apparently, it cannot be
> > said that FOP does something wrong per se. But the question pops up if
> > we should change the way we paint horizontal and vertical lines as part
> > of our border painting code.
> 
> Actually I played a part in changing the border drawing code from 
> rectangles to lines. Using a rectangle to draw a line didn't seem 
> correct to me, when PDF provides a perfectly good line drawing command.
> 
> > 
> > There's another thing. PDF allows to specify "0" as line width which
> > should result in 1 pixel on the target device. From the PDF Reference:
> > "However, some devices cannot reproduce 1-pixel lines, and on
> > high-resolution devices, they are nearly invisible. Since the results of
> > rendering such “zero-width” lines are device-dependent, their use is not
> > recommended." It would also be questionable how exactly we would
> > determine when to use "0" as line width. Probably not the best of ideas.
> > 
> > WDYT?
> 
> I don't think FOP does anything wrong, so I'd leave it.
> 
> Chris



Jeremias Maerki


Re: Line widths in PDF

Posted by Chris Bowditch <bo...@hotmail.com>.
Jeremias Maerki wrote:

> Philippe Drix made me look into why his borders don't show up properly
> in Acrobat Reader and his printer.
> 
> He specified border widths as 0.002cm: 0.002cm = 0.0567pt = 0.02mm 

:o I don't think this is a valid use case. Why would anyone want a 
border so thin??? Just tell Philippe to widen his border to say 0.5pt. 
Or provide a real world example of why such a thin border is required.

> 
> At 600dpi one dot/pixel is 1/600in = 0.00166666in = 0.12pt = 0.0423mm
> 
> So the border is less than half a pixel wide at 600dpi which is the
> nominal resolution for most laser printers today. Even at 1200dpi you
> don't have a full pixel, yet. 

Yes I know. Precisely why I don't think anything less than 0.5pt is a 
valid use case.

> 
> Digging into the source code, I found out: In FOP 0.20.5 horizontal and
> vertical lines are painted as rectangles (0.056pt wide). In FOP 0.92beta
> we're painting these lines as lines (0.056pt wide). So it appears that
> Acrobat Reader handles the two differently. Apparently, it cannot be
> said that FOP does something wrong per se. But the question pops up if
> we should change the way we paint horizontal and vertical lines as part
> of our border painting code.

Actually I played a part in changing the border drawing code from 
rectangles to lines. Using a rectangle to draw a line didn't seem 
correct to me, when PDF provides a perfectly good line drawing command.

> 
> There's another thing. PDF allows to specify "0" as line width which
> should result in 1 pixel on the target device. From the PDF Reference:
> "However, some devices cannot reproduce 1-pixel lines, and on
> high-resolution devices, they are nearly invisible. Since the results of
> rendering such “zero-width” lines are device-dependent, their use is not
> recommended." It would also be questionable how exactly we would
> determine when to use "0" as line width. Probably not the best of ideas.
> 
> WDYT?

I don't think FOP does anything wrong, so I'd leave it.

Chris