import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfTemplate;
import com.lowagie.text.pdf.PdfWriter;
public class DrawArcPDF {
public static void main(String[] args) {
Document document = new Document();
try {
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("DrawArcPDF.pdf"));
document.open();
PdfContentByte cb = writer.getDirectContent();
PdfTemplate template = cb.createTemplate(500, 200);
template.setLineWidth(2f);
template.arc(20f, 20f, 00f, -40f, 90f, 45f);
template.stroke();
template.setLineWidth(12f);
cb.addTemplate(template, 0, 1, -1, 0, 500, 200);
} catch (Exception e) {
System.err.println(e.getMessage());
}
document.close();
}
}
|