I have a itext report which will displays n number of idcodes which will display from db.But in the pdf it has certain limits showing these codes in one page. So all the datas will be displays collapsed. Please help me to find a solution to break the datas in column wise in pdf.
mainTab = new PdfPTable(prolength);
mainTab.setWidthPercentage(100);
mainTab.setHorizontalAlignment(Element.ALIGN_CENTER); Phrase phrase = new Phrase(); Paragraph paragraph1 = new Paragraph("CPT Reimbursement Analysis - By Carrier\n",new Font(Font.COURIER, 12, Font.BOLD)); phrase.add(paragraph1); Paragraph paragraph2 = new Paragraph("Selected By:Date of Entry",new Font(Font.COURIER, 8, Font.BOLD)); phrase.add(paragraph2); Paragraph paragraph3 = new Paragraph("Dates:"+insCPTReimbursementAnalysisReportForm.getDosFrom()+" to "+insCPTReimbursementAnalysisReportForm.getDosTo(),new Font(Font.COURIER, 8, Font.BOLD)); phrase.add(paragraph3); Phrase phraseFoot = new Phrase(); HeaderFooter header = new HeaderFooter(phrase,false); HeaderFooter footer = new HeaderFooter(phraseFoot,true); footer.setBorder(HeaderFooter.NO_BORDER); footer.setAlignment(HeaderFooter.ALIGN_CENTER); doc.setHeader(header); doc.setFooter(footer); doc.open(); PdfPCell pdfPCell = null;
LinkedHashMap<String,String[]> displaytotals = insCPTReimbursementAnalysisReportForm.getGetAllTotals(); if(displaytotals.size()>0){
String displayPage = "Average"+"\n"+"Count"+"\n"+"Total Amount"; pdfPCell = new PdfPCell(new Paragraph(displayPage,new Font(Font.COURIER, 8, Font.BOLD))); pdfPCell.setColspan(1); pdfPCell.setHorizontalAlignment(Element.ALIGN_CENTER); mainTab.addCell(pdfPCell); String cptcodetot = ""; String totalAvg = ""; String totalCount = ""; String totalAmt = ""; String[] arraytot = new String[3]; Set<String> keySettot = displaytotals.keySet(); Iterator<String> alltotal = keySettot.iterator(); while(alltotal.hasNext()) { cptcodetot = alltotal.next(); arraytot = displaytotals.get(cptcodetot); for(int i=0;i<arraytot.length;i++){ totalAvg = arraytot[0]; totalCount = arraytot[1]; totalAmt = arraytot[2]; } String allTotals = totalAvg+"\n"+totalCount+"\n"+totalAmt; pdfPCell = new PdfPCell(new Paragraph(allTotals,new Font(Font.COURIER, 8, Font.BOLD))); pdfPCell.setColspan(1); pdfPCell.setHorizontalAlignment(Element.ALIGN_CENTER); mainTab.addCell(pdfPCell); } }*/ /*Set<String> keySet = resultArray.keySet(); Iterator<String> iterator = keySet.iterator(); while(iterator.hasNext()) { String cptCode = ""; String[] array = new String[6]; String key = iterator.next(); InsCPTReimbursementReport cptReimbursementReport = resultArray.get(key); pdfPCell = new PdfPCell(new Paragraph(cptReimbursementReport.getInsCompName(),new Font(Font.COURIER, 8, Font.NORMAL))); pdfPCell.setColspan(1); pdfPCell.setHorizontalAlignment(Element.ALIGN_LEFT); mainTab.addCell(pdfPCell); LinkedHashMap<String, String[]> cptMap = cptReimbursementReport.getCptMapBean(); Iterator<String> it = insCPTReimbursementAnalysisReportForm.getCptDbList().iterator(); while(it.hasNext()) { cptCode = it.next(); array = cptMap.get(cptCode); if(array != null && array.length>0 ){ String values = array[5]+"\n"+array[4]+"\n"+array[3]; pdfPCell = new PdfPCell(new Paragraph(values,new Font(Font.COURIER, 8, Font.NORMAL))); pdfPCell.setColspan(1); pdfPCell.setHorizontalAlignment(Element.ALIGN_RIGHT); mainTab.addCell(pdfPCell); } else{ pdfPCell = new PdfPCell(new Paragraph(" ",new Font(Font.COURIER, 8, Font.NORMAL))); pdfPCell.setColspan(1); pdfPCell.setHorizontalAlignment(Element.ALIGN_LEFT); mainTab.addCell(pdfPCell); } } }