I have been looking at a customer PDF where we did not display the filled lines on the page. Firing up my debug tools showed that the lines were being converted to shapes and the clip and the color was correct. So where are the lines?
It turned out that because the lines had a width or height of 1 and a stroke width of less than 1, they were not being drawn. Or rather they were being drawn but with no width and no pixels. The fix is to use fillRect as this code snippet shows
//thin lines do not appear unless we use fillRect
g2.fillRect(currentShape.getBounds().x, currentShape.getBounds().y, currentShape.getBounds().width, currentShape.getBounds().height);
And the lines now appear! More of a Java bug, but still interesting… Have you seen any similar bugs with thin lines in Java?
IDRsolutions develop a Java PDF library, a PDF forms to HTML5 converter, a PDF to HTML5 or SVG converter and a Java Image Library that doubles as an ImageIO replacement. On the blog our team post about anything interesting they learn about.