Chris
Chris

Reputation: 221

iText rectangle - can't remove border

I can't seem to remove the border on a rectangle! See code below, I am creating a link using a PDFannotation. The links all work but each rectangle has a border.

PdfAnnotation annotation;
Rectangle rect = new Rectangle(xOffset, yOffset, xOffset + tab.getScaledWidth(),      yOffset+tab.getScaledHeight());

rect.setBorder(Rectangle.NO_BORDER);

annotation = PdfAnnotation.createLink(writer, rect, PdfAnnotation.HIGHLIGHT_NONE,      PdfAction.gotoLocalPage(section.GetStartPageIndex() + 1,destination, writer));

stamper.addAnnotation(annotation,i);

Upvotes: 3

Views: 2224

Answers (2)

user3466608
user3466608

Reputation: 1

Or you can use:

annotation.BorderStyle = new PdfBorderDictionary(0f, 0);

Upvotes: 0

Chris
Chris

Reputation: 221

I've realised it's the annotation which has the border, to remove use

annotation.setBorder(new PdfBorderArray(0f, 0f, 0f));

Upvotes: 4

Related Questions