Draw curve : Curve « PDF « Java Tutorial






import java.io.FileOutputStream;

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

public class MainClass {
  public static void main(String[] args) throws Exception {
    Document.compress = false;
    Document document = new Document();
    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
    document.open();
    PdfContentByte cb = writer.getDirectContent();
    cb.moveTo(100, 100);
    cb.lineTo(200, 200);
    cb.moveTo(300, 20);
    cb.lineTo(1, 3);
    cb.moveTo(0, 0);
    cb.curveTo(10, 10, 200, 200, 300, 30);

    cb.stroke();
    document.close();
  }
}








29.47.Curve
29.47.1.Draw curve