Closing Stroke : PdfContentByte « PDF RTF « Java






Closing Stroke

Closing Stroke
import java.io.FileOutputStream;

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

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

      document.open();
      PdfContentByte cb = writer.getDirectContent();

      cb.setLineWidth(10f);
      cb.setRGBColorStrokeF(0f, 255f, 0f);
      cb.moveTo(100, 700);
      cb.lineTo(200, 800);
      cb.lineTo(200f, 250f);
      cb.lineTo(400f, 150f);

      cb.closePathFillStroke();

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








itext.zip( 1,748 k)

Related examples in the same category

1.Drawing text using PdfContentByteDrawing text using PdfContentByte
2.Text alignment: Right LeftText alignment: Right Left
3.Setting Color for PdfContentByteSetting Color for PdfContentByte
4.PdfContentByte: RGBColorStrokeFPdfContentByte: RGBColorStrokeF
5.Stroke Line WidthStroke Line Width