Example usage for com.itextpdf.text Rectangle setUseVariableBorders

List of usage examples for com.itextpdf.text Rectangle setUseVariableBorders

Introduction

In this page you can find the example usage for com.itextpdf.text Rectangle setUseVariableBorders.

Prototype

public void setUseVariableBorders(final boolean useVariableBorders) 

Source Link

Document

Sets a parameter indicating if the rectangle has variable borders

Usage

From source file:fc.extensions.itext.Writer.java

License:MIT License

public void drawRectangleWithVariableBorder(Position position, float lineWidth, int borderType) {
    try {/*from w  w  w  .  java 2 s. c o m*/
        pdfWriterCB.saveState();
        pdfWriterCB.setRGBColorStroke(0, 0, 0);
        Rectangle rectangle = new Rectangle(position.getLeft(), position.getBottom(), position.getRight(),
                position.getTop());
        rectangle.setBorderWidth(lineWidth);
        rectangle.setBorder(borderType);
        rectangle.setUseVariableBorders(true);
        pdfWriterCB.rectangle(position.getLeft(), position.getBottom(), position.getWidth(),
                position.getHeight());
        pdfWriterCB.stroke();
    } finally {
        pdfWriterCB.restoreState();
    }
}