Hi all.
Maybe a silly question.

I need to produce a PDF structured as exampled in the image attached
(example.jpg).
I'm a newbie with iText (and to be honest, also with java ... :-D).

I'm doing the job in this way:

create a table, set property of table
create cell, set content and property of cell
close tab
empty table

and again :
create cell, set content and property of cell
close tab
empty table

and again and again..
etc etc

This way seems to me not much elegant and also need to be written lots
of code rows.
Here i post a sample code (result in attachment example.pdf) - i'm not
caring too much about style, for now:


//..................other code before here

//FIRST SECTION
                                        Table table = new Table(2);
                                        table.setBorderWidth(1);
                                        table.setBorderColor(new Color(210, 
210, 210));
                                        table.setPadding(3);
                                        table.setWidth(100);                    
                                        float[] f = {1f, 3f};                   
                
                                        table.setWidths(f);

                                        Cell cell = new Cell("Label 1");
                                        cell.setBorderColor(new Color(255, 255, 
255));
                                        table.addCell(cell);
                                        
                                        cell = new Cell("quick brown fox jumps 
over the lazy dog");
                                        cell.setBorderColor(new Color(255, 255, 
255));
                                        table.addCell(cell);
                                        lowDoc.add(table);

                                        lowDoc.add(new Paragraph(""));

                                        table.deleteAllRows();

//SECOND SECTION        
                                        cell = new Cell("Label2");
                                        //cell.setRowspan(2); 
//cell.setColspan(2)
                                        cell.setBorderColor(new Color(255, 255, 
255));
                                        table.addCell(cell);
                                        
                                        cell = new Cell("quick brown fox jumps 
over the lazy dog");
                                        //cell.setRowspan(2); 
//cell.setColspan(2)
                                        cell.setBorderColor(new Color(255, 255, 
255));
                                        table.addCell(cell);
                                        lowDoc.add(table);


                                        lowDoc.add(new Paragraph(""));

                                        table.deleteAllRows();

//..and so on for many other section

//..................other code after here


Of course, i'm not really writing "Label1", "Label2", "Label#"... , or
"quick brown fox jumps over the lazy dog" on any row. :-D

Is there a way to do the job in better way?
My source (if important) is a Lotus Notes Document, and the java
script will run locally on client (not from Lotus Domino web service).

I usually work creating an editable PDF (thanks also to Scribus!!) and
using iText + AcroForm, but in this case the fields i need to write do
not fit in a predefined size (as perfectly explained in figure 16.5,
pg 513 of iText bible ).

Any suggest/tip will be appreciated!

King Regards
Mirco

<<attachment: example.jpg>>

Attachment: example.pdf
Description: Adobe PDF document

-------------------------------------------------------------------------
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
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to