Java/PDF RTF/Circle — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 05:58, 1 июня 2010
Circles: Fill Without Stroke
import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter;
public class FillWithoutStrokeCirclesPDF {
public static void main(String[] args) {
Document document = new Document();
try {
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("FillWithoutStrokeCirclesPDF.pdf"));
document.open();
PdfContentByte cb = writer.getDirectContent();
cb.setRGBColorFill(0x00, 0xFF, 0xFF);
cb.circle(250.0f, 500.0f, 200.0f);
cb.circle(250.0f, 500.0f, 150.0f);
cb.circle(350.0f, 300.0f, 150.0f);
cb.fill();
} catch (Exception e) {
System.err.println(e.getMessage());
}
document.close();
}
}
Fill Circles
import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter;
public class FillCirclesPDF {
public static void main(String[] args) {
Document document = new Document();
try {
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("FillCirclesPDF.pdf"));
document.open();
PdfContentByte cb = writer.getDirectContent();
cb.setRGBColorFill(0xFF, 0x00, 0x00);
cb.circle(250.0f, 500.0f, 200.0f);
cb.circle(250.0f, 500.0f, 150.0f);
cb.circle(350.0f, 300.0f, 150.0f);
cb.fillStroke();
} catch (Exception e) {
System.err.println(e.getMessage());
}
document.close();
}
}
Using PdfContentByte to draw Circles
import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter;
public class CirclesPDF {
public static void main(String[] args) {
Document document = new Document();
try {
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("CirclesPDF.pdf"));
document.open();
PdfContentByte cb = writer.getDirectContent();
cb.circle(250.0f, 500.0f, 200.0f);
cb.circle(250.0f, 500.0f, 150.0f);
cb.circle(350.0f, 300.0f, 150.0f);
cb.stroke();
} catch (Exception e) {
System.err.println(e.getMessage());
}
document.close();
}
}