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?
Did you know...
IDRsolutions offers a whole range of online file converters to convert PDF and Microsoft Excel, Word and Office Documents to HTML5, SVG or image formats?
It is free to use for single file conversions and also includes Developer links if you want to use our commercial software for bulk conversions. Find out more on this page