Using PdfContentByte to draw Circles : Circle « PDF RTF « Java






Using PdfContentByte to draw Circles

Using PdfContentByte to draw Circles
import java.io.FileOutputStream;

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

public class CirclesPDF {
  public static void main(String[] args) {
    Document document = new Document();

    try {
      PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("CirclesPDF.pdf"));
      document.open();

      PdfContentByte cb = writer.getDirectContent();

      cb.circle(250.0f, 500.0f, 200.0f);
      cb.circle(250.0f, 500.0f, 150.0f);
      cb.circle(350.0f, 300.0f, 150.0f);
      cb.stroke();
      
    } catch (Exception e) {
      System.err.println(e.getMessage());
    }
    document.close();
  }
}
           
       








itext.zip( 1,748 k)

Related examples in the same category

1.Fill CirclesFill Circles
2.Circles: Fill Without StrokeCircles: Fill Without Stroke