Java Tutorial/PDF/Curve
Версия от 17:44, 31 мая 2010; (обсуждение)
Draw curve
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.rupress = 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();
}
}