Layer Shape on Text : Layer « PDF RTF « Java






Layer Shape on Text

Layer Shape on Text
import java.io.FileOutputStream;

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

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

      Paragraph p = new Paragraph();
      for (int i = 0; i < 100; i++)
        p.add(new Chunk("Text Text Text Text Text Text Text Text "));
      document.add(p);

      PdfContentByte cb = writer.getDirectContent();
      cb.setRGBColorFill(0xFF, 0xFF, 0xFF);
      cb.circle(250.0f, 500.0f, 50.0f);
      cb.fill();
      
    } catch (Exception e) {
      System.err.println(e.getMessage());
    }
    document.close();
  }

}

           
       








itext.zip( 1,748 k)

Related examples in the same category

1.Layer Image on TextLayer Image on Text
2.Layers Group Demo
3.Layers DemoLayers Demo