I'm using Pdfbox to draw some line on my document. Code:
contentStream.drawLine(startX, startY, startX, endY);
The result is an straight line. I wonder Does the PdfBox can draw dotted line?
Use the setLineDashPattern() call before doing your drawLine call:
public void setLineDashPattern(float[] pattern, float phase)
example:
setLineDashPattern (new float[]{3}, 0);
will configure a line pattern with 3 on, 3 off, 3 on, 3 off, etc
setLineDashPattern (new float[]{3,1}, 0);
will configure a line pattern with 3 on, 1 off, 3 on, etc
for more details on dash patterns, see the PDF specification.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With