chriaass
chriaass

Reputation: 315

How to get line thickness less than 1 with PDFBox

I have been trying to draw a thin horizontal line with PDFBox, but it appears that there is a limit for how thin I can draw the line. If I use a value less than one for the line thickness it looks the same as when I provide one for the value. Is this a limitation with PDFBox, or do I need to do something different?

// This looks the same as providing 1 for setLineWidth()
contentStream.setLineWidth(0.5f);
contentStream.setStrokingColor(Color.BLACK);
contentStream.moveTo(40f, 30f);
contentStream.lineTo(570f, 30f);
contentStream.closeAndStroke();

Upvotes: 4

Views: 5333

Answers (1)

user9035826
user9035826

Reputation:

A simple stroke call worked for me.

contentStream.setLineWidth(0.5f);
contentStream.moveTo(40f, 30f);
contentStream.lineTo(570f, 30f);
contentStream.stroke();

Upvotes: 1

Related Questions