To: Post all your questions about iText here <itext-questions@lists.sourceforge.net>
Sorry Clair W. Cabal about overlapping a
previous thread. I just did a quick reply from my inbox.
Mark Storer, Thanks for the reply.
1) Try a
different G2D
I didn't understand from this. How do i create a different one?
2) The table perfectly prints. So its not a white one. (Hope u looked at the attachment. I created that using a PDF print driver from my actual Table. So the table does exists.)
3)Well its a fresh pdf. I delete any previously existing pdf. How do I set the PdfTemplate's boundries from actual table boundaries.
Peace n Regards,
Chandrajeet
It looks
like you're running into one of several possible problems:
1) You're
not actually drawing anything.
Try a
different G2D to test your output. You may already know the table writes
successfully to your UI or whatever.
2) You're
not drawing anything visible.
White one
white, that sort of thing. Probably not the issue.
3) You're
drawing outside the visible area.
The page's
boundries are one limitation, but the PdfTemplate's boundries are another.
If the table is offset vertically greater than it's height, you'll never see it,
ditto for horizontal/width.
If you were
working with an existing PDF, you'd have to worry about page rotation too... but
that doesn't apply in this case.
--Mark Storer
Senior Software Engineer
Cardiff.com
#include <disclaimer>
typedef std::Disclaimer<Cardiff> DisCard;
Hi
All,
I want a PDF output of a large JTable without any pagination.
I
am sending a sample output attached.
Whatever may be the row or column
count, I want that in a single page. With the cell colors retained.
I
used the following code: -
Document document = new Document();
table.setVisible(true);
try
{
// step
2: creation of the
writer
PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream(FILE_NAME));
// step
3: we open the
document
document.open();
// step
4: we grab the ContentByte and do some stuff with
it
// we
create a template and a Graphics2D object that corresponds with
it
int w
=
table.getWidth();
int h =
table.getHeight();
PdfContentByte cb =
writer.getDirectContent();
PdfTemplate tp = cb.createTemplate(w,
h);
Graphics2D g2 = tp.createGraphics(w,
h);
tp.setWidth(w);
tp.setHeight(h);
table.paint(g2);
g2.dispose();
cb.addTemplate(tp, 50,
400);
}
catch(DocumentException de)
{
System.err.println(de.getMessage());
}
catch(IOException ioe)
{
System.err.println(ioe.getMessage());
}
// step 5: we close the
document
document.close();
But this prints absolutely nothing .
Thanks
with Yahoo! FareChase.