Shape: DashLine : Line « PDF RTF « Java






Shape: DashLine

Shape: DashLine
import java.io.FileOutputStream;

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

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

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

      cb.setLineWidth(10f);
      cb.setLineDash(3, 3, 0);
      cb.moveTo(100, 700);
      cb.lineTo(200, 800);

      cb.stroke();

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








itext.zip( 1,748 k)

Related examples in the same category

1.Shape: LineShape: Line
2.Draw Line CapDraw Line Cap
3.Drawing Lines using PdfContentByteDrawing Lines using PdfContentByte