PdfShading.simpleRadial : Shading « PDF « Java Tutorial






import java.awt.Color;
import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfShading;
import com.lowagie.text.pdf.PdfShadingPattern;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.ShadingColor;

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();
    PdfShading radial = PdfShading.simpleRadial(writer, 200, 500, 50, 300, 500, 100, new Color(255,
        247, 148), new Color(247, 138, 107), false, false);
    cb.paintShading(radial);


    document.close();
  }
}








29.15.Shading
29.15.1.PdfShading.simpleRadial
29.15.2.PdfShading.simpleAxial
29.15.3.Spot Color