import java.awt.Color;
import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter;
public class MainClass {
public static void main(String[] args) throws Exception {
Document.compress = false;
Document document = new Document();
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
document.open();
PdfContentByte cb = writer.getDirectContent();
cb.circle(26.0f, 50.0f, 25.0f);
cb.fill();
cb.saveState();
cb.setColorFill(Color.yellow);
cb.circle(26.0f, 50.0f, 20.0f);
cb.fill();
cb.saveState();
cb.setColorFill(Color.red);
cb.circle(26.0f, 50.0f, 15.0f);
cb.fill();
cb.restoreState();
cb.circle(26.0f, 50.0f, 10.0f);
cb.fill();
cb.restoreState();
cb.circle(26.0f, 50.0f, 5.0f);
cb.fill();
document.close();
}
}
|