I use table within a table when generating the PDF and i get the following error.
com.ost.radhaz.struts.survey.action.PreviewSurveyAction caught an exception: com.lowagie.text.BadElementException
com.lowagie.text.BadElementException: ***Adding a cell at the location (4,1) with a colspan of 1 and a rowspan of 1 is illegal (beyond boundaries/overlapping).***
at com.lowagie.text.Table.addCell(Unknown Source)
at com.ost.radhaz.struts.survey.action.PreviewSurveyAction.generatePDFDocumentBytes(PreviewSurveyAction.java:882)
at com.ost.radhaz.struts.survey.action.PreviewSurveyAction.execute(PreviewSurveyAction.java:81)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
at org.securityfilter.filter.SecurityFilter.doFilter(SecurityFilter.java:182)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:644)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:391)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:908)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:458)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:226)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:127)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:116)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Unknown Source)
I looked up online to find out that iText does not use tables anymore and they suggest using PDFPTable. Apparently for the volume of code that uses table within table in my code, i tried to experiment with just a block of code to see if PDFPtable generates the PDF. Apparently not, I was able to get past the above error, but the PDFPcell that i use to show a particular text chunk does not show up. It shows up as empty. Please advise.
Below is the code i use for PDFPcell
Phrase p2 = new Phrase("This is test phrase2", FontFactory.getFont(FontFactory.COURIER, 30, Font.NORMAL, new Color(255, 0, 0)));
PdfPCell test2 = new PdfPCell(p2);
optable.addCell(test2);
This phrase above does not show up in my PDF, it shows up as empty, even though i got to generate the PDF
Please note that in my block of code used above optable is the PDFPtable and that is again embedded in a Table (not PDFPtable).