import java.awt.Color;
import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.pdf.CMYKColor;
import com.lowagie.text.pdf.GrayColor;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter;
public class MainClass {
public static void main(String[] args) throws Exception {
Document document = new Document();
PdfWriter writer = PdfWriter.getInstance(
document,
new FileOutputStream("2.pdf"));
document.open();
PdfContentByte cb = writer.getDirectContent();
cb.setColorFill(new GrayColor(0));
cb.rectangle(36, 770, 36, 36);
cb.fillStroke();
cb.setGrayFill(1);
cb.rectangle(470, 716, 36, 36);
cb.fillStroke();
cb.setColorFill(new Color(1f, 1f, 1f));
cb.rectangle(416, 662, 36, 36);
cb.fillStroke();
cb.setRGBColorFillF(1f, 1f, 1f);
cb.rectangle(416, 608, 36, 36);
cb.fillStroke();
cb.setColorFill(new CMYKColor(0f, 0f, 0f, 1f));
cb.rectangle(416, 554, 36, 36);
cb.fillStroke();
cb.setCMYKColorFillF(0f, 0f, 0f, 1f);
cb.rectangle(416, 500, 36, 36);
cb.fillStroke();
document.close();
}
}
|