hi all,
I have been struggling with this and I cannot figure out the reference
between these objects. I have the following code:
------------------------------------------------------------------------------------------------------------
Document document = new Document();
PdfWriter writer = PdfWriter.getInstance(document, new
FileStream("C:\\test.pdf", FileMode.Create));
document.open();
int x = 0;
int y = 600;
int w = 200;
int h = 200;
PdfContentByte cb = writer.getDirectContent();
Graphics2D g2 = cb.createGraphics(w, h);
Arc2D.Float arc = new Arc2D.Float(x, y, w, h, 0, -109, Arc2D.PIE);
Arc2D.Float arc2 = new Arc2D.Float(x, y, w, h, -109, -81, Arc2D.PIE);
Arc2D.Float arc3 = new Arc2D.Float(x, y, w, h, -109 - 81, -132, Arc2D.PIE
);
Arc2D.Float arc4 = new Arc2D.Float(x, y, w, h, -109 - 81 - 132, -35,
Arc2D.PIE);
arc.setFrame(x, y, 150.0, 100.0);
arc2.setFrame(x, y, 150.0, 100.0);
arc3.setFrame(x, y, 150.0, 100.0);
arc4.setFrame(x, y, 150.0, 100.0);
g2.setColor(Color.red);
g2.fill(arc);
g2.setColor(Color.blue);
g2.fill(arc2);
g2.setColor(Color.yellow);
g2.fill(arc3);
g2.setColor(Color.green);
g2.fill(arc4);
g2.dispose();
document.close();
Process.Start("C:\\test.pdf");
------------------------------------------------------------------------------------------------------------
Nothing seems to get printed onto the pdf, although when I tweak the values
of x, y, width, height i get some sort of graph but nowhere where it would
make sense to me. All i really want to do is to draw a pie graph in a given
rectangle, given its x, y position on the page. How can i make that
possible? Any help would be appreciated.
Thanks
Ruskin
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/