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?
Are you a Developer working with PDF files?
Our developers guide contains a large number of technical posts to help you understand the PDF file Format.
Find out more about our software for Developers
|Convert PDF to HTML5 or SVG|
|Convert AcroForms and XFA to HTML5|
|Java PDF SDK for working with PDF files|