How to draw dotted line in pdfBox
I am using Pdfbox to draw some line in my document. Code:
contentStream.drawLine(startX, startY, startX, endY);
The result is straightforward. I wonder if PdfBox can draw a dotted line?
+3
Ranga Ron
source
to share
1 answer
Use the setLineDashPattern () call before making the drawLine call:
public void setLineDashPattern(float[] pattern, float phase)
Example:
setLineDashPattern (new float[]{3}, 0);
the line pattern will be set from 3 to, 3 off, 3 to, 3 off. etc.
setLineDashPattern (new float[]{3,1}, 0);
configures a linear pattern with 3 on, 1 off, 3 on. etc.
for more details on the dash, see the PDF specification .
+5
Tilman hausherr
source
to share