Shape: Rectangle : Rectangle « PDF RTF « Java






Shape: Rectangle

Shape: Rectangle
import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter;

public class ShapeRectanglePDF {
  public static void main(String[] args) {
    Document document = new Document();
    try {
      PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("ShapeRectanglePDF.pdf"));

      document.open();
      PdfContentByte cb = writer.getDirectContent();

      cb.setLineWidth(10f);
      cb.rectangle(100, 700, 100, 100);
      cb.stroke();

    } catch (Exception e) {
      System.err.println(e.getMessage());
    }
    document.close();
  }
}
           
       








itext.zip( 1,748 k)

Related examples in the same category

1.Adding Rectangle to a ColumnAdding Rectangle to a Column
2.Drawing RectangleDrawing Rectangle