Java PDF: Barré ou rayer un texte du document PDF

Author:

Java PDF: Barré ou rayer un texte du document PDF
{filelink=10353}

/***** Code de MesExemples.com *******/
/**
 * @(#)RayerBarrePDF.java
 *
 *
 * @author 
 *sakoba(java.mesexemples.com) @version 1.00 2013/4/26
 */


import java.io.FileOutputStream;

import com.itextpdf.text.Chunk;
import com.itextpdf.text.Document;
import com.itextpdf.text.pdf.PdfWriter;

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

      Chunk strikethru = new Chunk("Ce texte sera barré");
      strikethru.setUnderline(0.5f, 3f);  
      document.add(strikethru);

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

Leave a Reply

Your email address will not be published. Required fields are marked *