Layer Image on Text : Layer « PDF RTF « Java






Layer Image on Text

Layer Image on Text
import java.io.FileOutputStream;

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

public class LayerImageOnTextPDF {
  public static void main(String[] args) {
    Document document = new Document();
    try {
      PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("LayerImageOnTextPDF.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);

      Image img = Image.getInstance("logo.png");
      img.setAbsolutePosition(100, 500);
      document.add(img);

    } catch (Exception e) {
      System.err.println(e.getMessage());
    }
    document.close();
  }

}

           
       








itext.zip( 1,748 k)

Related examples in the same category

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