I was trying to run the sample code provided for creating a pdf with
table and I was encountering an error while trying to add a cell object.
I have pasted the code below and the line causing the exception is
colored blue. Please I need help.

 

                        Document document = new Document();

 

                        try {

                                    // step 2:

                                    // we create a writer that listens
to the document

                                    // and directs a PDF-stream to a
file

                                    PdfWriter.getInstance(document, new
FileOutputStream("MyFirstTable.pdf"));

 

                                    // step 3: we open the document

                                    document.open();

 

                                    PdfPTable table = new PdfPTable(3);

                                    PdfPCell cell = new PdfPCell(new
Paragraph("header with colspan 3"));

                                    cell.setColspan(3);

                                    table.addCell(cell);

                                    table.addCell("1.1");

                                    table.addCell("2.1");

                                    table.addCell("3.1");

                                    table.addCell("1.2");

                                    table.addCell("2.2");

                                    table.addCell("3.2");

                                    cell = new PdfPCell(new
Paragraph("cell test1"));

                                    cell.setBorderColor(new Color(255,
0, 0));

                                    table.addCell(cell);

                                    cell = new PdfPCell(new
Paragraph("cell test2"));

                                    cell.setColspan(2);

                                    cell.setBackgroundColor(new
Color(0xC0, 0xC0, 0xC0));

                                    table.addCell(cell);

                                    document.add(table);

                        } catch (DocumentException de) {

 
System.err.println("de.getMessage());

                        } catch (IOException ioe) {

 
System.err.println(ioe.getMessage());

                        }

 

                        // step 5: we close the document

                        document.close();

 

 

 

 

 

 

 

The exception thrown is:

Exception in thread main

java.lang.VerifyError: com.lowagie.text.pdf.PdfPRow

      at com.lowagie.text.pdf.PdfPTable.addCell(PdfPTable.java:404)

      at
com.lowagie.examples.objects.tables.MyFirstTable.main(MyFirstTable.java:
58)

 

Please I'll appreciate any help as soon as possible.

 

 

Okuwa Asbjorn Nwanze
e-Payment Solutions

Infotech Department
Zenith Bank Plc
Victoria Island, Lagos.
234-802-501-8793 (cell)
234-803-505-4460 (cell)

234-1-278-1560
234-1-278-4000 -3 (ext. 1560) (office)

 

The information contained in this e-mail message and any attachment is for 
designated recipient(s) ONLY and may contain privileged, proprietary, or 
private information. If you have received it in error, please delete the 
message and notify the sender immediately. Zenith Bank accepts no liability 
whatsoever for any loss whether it be direct, indirect or consequential, 
arising from information made available and actions resulting there from.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to