So I'm just trying to start out using the Graphics2D version of iText, and
for some reason, I'm not seeing anything showing up... the pdf is created,
but it's blank. My code is below. Any help you could offer would be
greatly appreciated.
FYI... I'm using iText version 1.4.1, but I tried it with 2.1.3 with no
success.
Thanks.
-Neel
public static void main(String args[]) {
try {
FileOutputStream fos = new FileOutputStream("/tmp/print/test.pdf");
doTest(fos);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Done");
}
public static void doTest(OutputStream os) {
try {
Document d = new Document();
PdfWriter writer = PdfWriter.getInstance(d, os);
d.open();
PdfContentByte cb = writer.getDirectContent();
Graphics2D g2 = cb.createGraphics(300, 900);
g2.setColor(Color.black);
g2.drawString("Testing", 20, 20);
g2.dispose();
d.close();
os.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php