Hi,
iText Version: 2.1.3

I have a 62 column spreadsheet (CSV format), very basic, just outputs
strings to each cell. I'm trying to produce the same exact layout/content in
PDF format with iText. The problem is, there are 62 column headers and this
does not fit on the page very well (at all actually). I've tried to use the
PdfPTable.writeSelectedRows() method to span/split multiple pages
horizontally for the columns but that doesn't seem to work.

My main problem is that each cell is squishing the text I write into it. It
prints 1 character wide then writes the next character underneath it  so it
looks like this in a single column table cell:
R
e
g
i
s
t
...

The word 'Registrant' is not expanding the cell from a width perspective.
Here is my code...

[code]

javax.servlet.http.HttpServletResponse response = params.getResponse();
response.setContentType("application/pdf");
response.addHeader("Content-Disposition", " attachment;
filename=\""+filename+".pdf\"");
Document document = new Document();
PdfPTable table = new PdfPTable(62);
PdfWriter writer =
PdfWriter.getInstance(document, response.getOutputStream());
document.open();

// Testing purpose only... using dummy 'Registrant' string for testing!
for(int i=1,j=table.getNumberOfColumns(); i<=j; i++) {
    table.addCell("Registrant");
}

// I've tried using this method to split the columns onto multiple pages
// but it doesn't seem to work the way I'm doing it...
//table.writeSelectedRows(0, 5, 0, -1, 50, 650, writer.getDirectContent());
//document.newPage();
//table.writeSelectedRows(5, 10, 0, -1, 50, 650, writer.getDirectContent());
//document.newPage();
//table.writeSelectedRows(10, 15, 0, -1, 50, 650,
writer.getDirectContent());
// ... trimmed for brevity.

document.close();

[/code]

Can anyone please tell me what I'm doing wrong here?

Thank you!

- Billy -
-------------------------------------------------------------------------
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

Reply via email to