Hi Cameron,
some time ago, I faced the same problem.
My solution was a little bit different, but It also took impact on
the iText source code (classes PdfPTable and PdfDocument) which was
kindly accepted by Paulo Soares.
My solution was to define a limit of lines to output per PdfPTable
instance. If the need for a break is detected, the table is added to the
document. After that a new table is built. This new table gets the
property skipFirstHeader set to true. This property is noticed by the
PdfDocument and the output of the defined header line is suppressed for
the output of this header. With this solution you can
split the output of a big data amount in fix segments, which keeps the
data consumption low.
Best regards,
Christian
On Wed, 2004-02-25 at 12:47, Carmona Perez, David wrote:
> What steps should I do in order to incorportate the improvements I have made to
> iText?
>
> I think are quite generic and they may be useful to other people using iText.
>
> I have them documented, and explained.
>
> --------
> David
>
> -----Mensaje original-----
> De: Carmona Perez, David
> Enviado el: viernes, 20 de febrero de 2004 9:08
> Para: Itext-Questions (E-mail)
> Asunto: RV: [iText-questions] RV: PdfWriter.fitsPage()
>
> The speed improvements I have gotten by preventing rendering more than once a table
> with fitsPage(), are spectacular. It takes less than half the time.
>
>
> --------
> David
>
> -----Mensaje original-----
> De: Carmona Perez, David
> Enviado el: jueves, 19 de febrero de 2004 16:14
> Para: Itext-Questions (E-mail)
> Asunto: [iText-questions] RV: PdfWriter.fitsPage()
>
> I repost the message, because of the lose of formatting, prevents good readability.
>
> --------
> David
>
> -----Mensaje original-----
> De: Carmona Perez, David
> Enviado el: jueves, 19 de febrero de 2004 15:58
> Para: Itext-Questions (E-mail)
> Asunto: PdfWriter.fitsPage()
>
> Hi Paulo, Bruno,
>
> I have the following needs:
>
> 1- Build tables with arbitrary rowspans and colspans
> 2- Tables can be very big in size, so memory consumption is important
> 3- Must be quick
>
> Discarded solutions
> 1- Use PdfPTable by need 1
> 2- Build a big table in memory and the render it, by need 2
> 3- Use PdfWriter.fitsPage(Table) because is very slow. If we call it for every row,
> a PdfTable is created each time.
>
> Proposed solution:
> Use the Table class, and use a changed version of iText.
>
> Changes:
> I have changed the iText library version 1.02b (latest one), without breaking
> compatibility with previous APIs, that would like to share with the iText community
> and integrate with current code.
>
> The changes consist mainly of the following new methods in class PdfWriter:
>
> public PdfTable getPdfTable(Table table) {
> return pdf.getPdfTable(table, true);
> }
>
> public boolean breakTableIfDoesnFit(PdfTable table) throws DocumentException
> {
> return pdf.breakTableIfDoesnFit(table);
> }
>
> All methods of PdfTable remain private, so the user code doesn't have to interact
> with this class, the Table interface is used instead. It could even be replaced
> with a marker interface, if we don't want to expose this implementation class.
>
> Typical use scenario of this new functions:
>
> PdfWriter writer;
> ....
> Table table = new Table();
> PdfTable pdfTable = writer.getPdfTable();
> ...
> for (int i = 0; i < bigNumberOfRows; i++) {
> Cell column1, column2, column3;
> ...
> table.addCell(column1);
> table.addCell(column2);
> table.addCell(column3);
> /* This method which is very quick, renders a page of a PdfTable
> if it doesn't fit the current page, and empties both table and pdfTable
> in that case. Its use is optional*/
> writer.breakTableIfDoesntFit(pdfTable);
> }
> // Write remaining rows. document.add() accepts either a Table or a PdfTable
> document.add(pdfTable);
>
> What do you think?
>
> --------
> David
>
>
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id56&alloc_id438&op=ick
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
>
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id56&alloc_id438&op=ick
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
>
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id56&alloc_id438&op=click
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
--
Christian Lauer <[EMAIL PROTECTED]>
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions