To Generate PDF Using Itext
To Generate PDF Using Itext
Header and Footer of the PDF:
import java.util.Date;
import com.itextpdf.text.Document;
import com.itextpdf.text.Element;
import com.itextpdf.text.Font;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.ColumnText;
import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfPageEventHelper;
import com.itextpdf.text.pdf.PdfWriter;
import com.itextpdf.text.pdf.draw.LineSeparator;
public class HeaderFooter extends PdfPageEventHelper
{
public void onEndPage (PdfWriter writer, Document document)
{
Rectangle rect = writer.getBoxSize("art");
PdfContentByte canvas =writer.getDirectContent();
rect.setBorder(Rectangle.BOX); // left, right, top, bottom border
rect.setBorderWidth(1); // a width of 5 user units
rect.setUseVariableBorders(true); // the full width will be visible
canvas.rectangle(rect);
final LineSeparator lineSeparator = new LineSeparator();
Font font1 = new Font(Font.FontFamily.HELVETICA , 20, Font.BOLD);
Paragraph paragraph = new Paragraph();
paragraph.setFont(font1);
paragraph.setAlignment(Element.ALIGN_CENTER);
paragraph.add("Heading No 1");
Font font2 = new Font(Font.FontFamily.TIMES_ROMAN , 12);
Paragraph paragraph2 = new Paragraph();
paragraph2.setFont(font2);
paragraph2.setAlignment(Element.ALIGN_CENTER);
// paragraph2.add("(Heading No 2)");
Paragraph paragraph1 = new Paragraph();
paragraph1.setAlignment(Element.ALIGN_CENTER);
paragraph1.add("Heading No 3");
paragraph2.add(" ");
ColumnText.showTextAligned(writer.getDirectContent(),
Element.ALIGN_CENTER,paragraph,
(rect.getLeft() + rect.getRight()) / 2, rect.getTop() -22, 0);
ColumnText.showTextAligned(writer.getDirectContent(),
Element.ALIGN_CENTER,paragraph2,
(rect.getLeft() + rect.getRight()) / 2, rect.getTop() -35, 0);
ColumnText.showTextAligned(writer.getDirectContent(),
Element.ALIGN_CENTER,paragraph1,
(rect.getLeft() + rect.getRight()) / 2, rect.getTop() - 49 , 0);
lineSeparator.drawLine(canvas, rect.getLeft(),rect.getRight(), rect.getTop() - 52);
System.out.println( rect.getLeft() +"\t"+rect.getRight() +"\t"+rect.getTop() +"\t"+rect.getBottom());
ColumnText.showTextAligned(writer.getDirectContent(),
Element.ALIGN_RIGHT, new Phrase(String.format("page %d", writer.getPageNumber()-1)),(rect.getRight()),rect.getBottom() - 18,0);
Date date = new Date();
ColumnText.showTextAligned(writer.getDirectContent(),
Element.ALIGN_LEFT, new Phrase(String.format("Date:"+ date.toString().substring(0,19) )),
(rect.getLeft()), rect.getBottom() - 18, 0);
}
}
---------------------------------------------Body of the PDF Page:
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import com.comp.portal.dao.impl.ClientAddressDAOImpl;
import com.comp.portal.dao.impl.ClientDetailsDAOImpl;
import com.comp.portal.model.ClientAddress;
import com.comp.portal.model.ClientDetails;
import com.comp.portal.model.JobDocket;
import com.comp.portal.model.JobDocketDesign;
import com.comp.portal.model.JobdocketEpzSales;
import com.comp.portal.model.OrderAddress;
import com.comp.portal.model.OrderAddressJobdocket;
import com.comp.portal.model.OrderDetails;
import com.comp.portal.model.OrderIsbnDetails;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Chunk;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element;
import com.itextpdf.text.Font;
import com.itextpdf.text.FontFactory;
import com.itextpdf.text.Image;
import com.itextpdf.text.PageSize;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.Font.FontFamily;
import com.itextpdf.text.html.WebColors;
import com.itextpdf.text.pdf.Barcode;
import com.itextpdf.text.pdf.Barcode128;
import com.itextpdf.text.pdf.BarcodePDF417;
import com.itextpdf.text.pdf.BarcodeQRCode;
import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfPageEvent;
import com.itextpdf.text.pdf.PdfWriter;
public class AllJobDocketPdf extends AbstractPdfView
{
/** The path to the font. */
public static final String f8 = "c:/windows/fonts/ariblk.ttc";
@Autowired
@Override
protected void buildPdfDocument(Map<String, Object> model,
Document document, PdfWriter writer, HttpServletRequest request,
HttpServletResponse response) throws Exception
{
System.out.println("Came to PDF 01-02-2017");
//document = new Document(PageSize.A4, marginLeft, marginRight, marginTop, 788);
// document.setMargins(38, 38, 140,60); // left right top bottom
ArrayList<Object> obj = (ArrayList<Object>) model.get("addressListDetails");
ArrayList<JobdocketEpzSales>list = (ArrayList<JobdocketEpzSales>) obj.get(0);
// ArrayList<JobDocketDesign> jobDocketDesign = (ArrayList<JobDocketDesign>)obj.get(1); //Commented on 02-02-2017 for checking purpose
// ArrayList<String> inner1=(ArrayList<String>)obj.get(2); //Commented on 02-02-2017 for checking purpose
// ArrayList<String> cover1=(ArrayList<String>)obj.get(3); //Commented on 02-02-2017 for checking purpose
System.out.println("Came to PDF 01-02-2018");
// System.out.println("c "+list.size());
// System.out.println("The JobDocketDesign values "+jobDocketDesign.size()); //Commented on 02-02-2017 for checking purpose
ArrayList<Integer>Jds=new ArrayList<Integer>();
// ArrayList<String>s=new ArrayList<String>();
// for(JobDocketDesign jds:jobDocketDesign)
// { //Commented on 02-02-2017 for checking purpose
// Jds.add(jds.getJobDocketId());
// }
// for(String id:inner1)
// { //Commented on 02-02-2017 for checking purpose
// s.add(id);
// }
// System.out.println("The Inner Values are "+s);
try
{
document.setMargins(-24, -24, 135,60);
writer.setBoxSize("art", new Rectangle(36, 54, 559, 788));
HeaderFooter event = new HeaderFooter();
writer.setPageEvent((PdfPageEvent) event);
document.open();
PdfPTable upperTable = new PdfPTable(6);
PdfPTable upperTable1 = new PdfPTable(2);
PdfPTable upperTable2 = new PdfPTable(4);
PdfPTable upperTable8 = new PdfPTable(8);
PdfPTable upperTable3 = new PdfPTable(1);
PdfPTable upperTable4 = new PdfPTable(1);
PdfPTable upperTable5 = new PdfPTable(1);
PdfPTable upperTable6 = new PdfPTable(1);
PdfPTable upperTable7 = new PdfPTable(1);
// PdfPTable table2 = new PdfPTable(1);
PdfPTable table2 = new PdfPTable(6);
PdfPTable table = new PdfPTable(8);
PdfPTable table3 = new PdfPTable(8);
PdfPTable table14 = new PdfPTable(2);
PdfPTable table15 = new PdfPTable(6);
PdfPTable table16 = new PdfPTable(6);
PdfPTable table17 = new PdfPTable(4);
PdfPTable table18 = new PdfPTable(5);
PdfPTable table1 = new PdfPTable(2);
PdfPTable table4 = new PdfPTable(4);
PdfPTable table5 = new PdfPTable(4);
PdfPTable table8 = new PdfPTable(4);
PdfPTable table9 = new PdfPTable(4);
PdfPTable table6 = new PdfPTable(6);
PdfPTable table7 = new PdfPTable(6);
PdfPTable table10 = new PdfPTable(4);
PdfPTable table11 = new PdfPTable(4);
// PdfPTable table12 = new PdfPTable(4);
// PdfPTable table13 = new PdfPTable(4);
PdfContentByte cb = writer.getDirectContent();
PdfContentByte cb1 = writer.getDirectContent();
PdfContentByte cb2 = writer.getDirectContent();
PdfContentByte cb3 = writer.getDirectContent();
for(JobdocketEpzSales jobDocket: list)
{
Font f1 = new Font(FontFamily.TIMES_ROMAN, 12.0f, Font.BOLD, BaseColor.WHITE);
Font f8 = new Font(FontFamily.TIMES_ROMAN, 14.0f, Font.BOLD, BaseColor.WHITE);
Font f10 = new Font(FontFamily.TIMES_ROMAN, 14.0f, Font.BOLD, BaseColor.BLACK);
Font f2 = new Font(FontFamily.TIMES_ROMAN, 10.0f, Font.NORMAL, BaseColor.BLACK);
Font f3 = new Font(FontFamily.TIMES_ROMAN, 11.5f, Font.BOLD, BaseColor.WHITE);
Font f9 = new Font(FontFamily.TIMES_ROMAN, 11.5f, Font.BOLD, BaseColor.BLACK);
Font f4 = new Font(FontFamily.HELVETICA, 12.0f, Font.BOLD, BaseColor.BLACK);
Font f11 = new Font(FontFamily.HELVETICA, 14.0f, Font.BOLD, BaseColor.BLACK);
Font f5 = new Font(FontFamily.TIMES_ROMAN, 12.0f, Font.BOLD, BaseColor.BLACK);
Font f6 = new Font(FontFamily.TIMES_ROMAN, 16.0f, Font.BOLD, BaseColor.BLACK);
Font f7 = new Font(FontFamily.TIMES_ROMAN, 18.0f, Font.BOLD, BaseColor.BLACK);
System.out.println("The JobID"+jobDocket.getJobDocketId());
// System.out.println("The JobID"+jobDocketDesign); //Commented on 02-02-2017 for checking purpose
System.out.println("The Check JobDocketDesign values "+Jds.contains(jobDocket.getJobDocketId()));
upperTable7.setTotalWidth(515);
upperTable7.getDefaultCell().setPadding(4);
upperTable7.setWidthPercentage(100.0f);
PdfPCell cell7 = upperTable7.getDefaultCell();
upperTable7.setWidths(new float[] {96});
upperTable7.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
// upperTable.getDefaultCell().setBackgroundColor(BaseColor.BLACK);
cell7.setVerticalAlignment(Element.ALIGN_TOP);
upperTable7.addCell(new Phrase("JobDocket - EPZ ",f7));
upperTable7.writeSelectedRows(0,-1,40,734,cb);
upperTable7.flushContent();
document.add(upperTable7);
upperTable7.flushContent();
PdfPCell cell9 = upperTable.getDefaultCell();
BaseColor myColor2 = WebColors.getRGBColor("#000000");
int jobid1=jobDocket.getJobDocketId();
String jobdocketid1 = Integer.toString(jobid1);
upperTable.setTotalWidth(515);
upperTable.getDefaultCell().setPadding(4);
// upperTable.setWidthPercentage(100.0f);
upperTable.setWidths(new float[] {16,16,16,16,16,16});
// cell9.setFixedHeight(24f);
// cell9.setNoWrap(false);
upperTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
// upperTable.getDefaultCell().setBackgroundColor(BaseColor.BLACK);
Date strDat=jobDocket.getDate();
DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
String Ddate = formatter.format(strDat);
Date strDate=jobDocket.getDuedate();
DateFormat formatter1 = new SimpleDateFormat("dd-MM-yyyy");
String Duedate = formatter1.format(strDate);
upperTable.addCell(new Phrase("Date:",f10));
// upperTable.addCell(new Phrase(Ddate,f8));
upperTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
PdfPCell cell81 = new PdfPCell(new Phrase(Ddate,f8));
cell81.setBackgroundColor(myColor2);
upperTable.addCell(cell81);
upperTable.addCell(new Phrase("DueDate:",f10));
// upperTable.addCell(new Phrase(Duedate,f8));
upperTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
PdfPCell cell82 = new PdfPCell(new Phrase(Duedate,f8));
cell82.setBackgroundColor(myColor2);
upperTable.addCell(cell82);
upperTable.addCell(new Phrase("JobId",f10));
// upperTable.addCell(new Phrase(jobdocketid1,f8));
upperTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
PdfPCell cell83 = new PdfPCell(new Phrase(jobdocketid1,f8));
cell83.setBackgroundColor(myColor2);
upperTable.addCell(cell83);
// upperTable.addCell(new Phrase("DueDate:"+Duedate,f8));
//
// upperTable.addCell(new Phrase("JobId:"+jobDocket.getJobDocketId(),f8));
upperTable.writeSelectedRows(0,-1,40,709,cb);
upperTable.flushContent();
document.add(upperTable);
upperTable.flushContent();
//---------------Repeat Header---------------------------------------------------------------
upperTable1.setTotalWidth(515);
upperTable1.getDefaultCell().setPadding(2);
upperTable1.setWidths(new float[] {52,40});
// upperTable1.getDefaultCell().setPadding(4);
PdfPCell cell1 = upperTable1.getDefaultCell();
cell1.setBorder(Rectangle.NO_BORDER);
// cell1.setFixedHeight(24f);
int jobId=jobDocket.getJobDocketId();
// Barcode128 code128 = new Barcode128();
// code128.setBarHeight(10);
// code128.setSize(5);
// code128.setCode(String.valueOf(jobId));
cell1.setVerticalAlignment(Element.ALIGN_MIDDLE);
// upperTable1.addCell(new Phrase("ISBN : "+jobDocket.getIsbn(),f6));
upperTable1.addCell(new Phrase("Client Name : "+jobDocket.getClientname().toLowerCase(),f6));
// upperTable1.addCell(new Phrase(,f6));
// String bhavishid=jobDocket.getOrderDetails().getBhavishOrderId();
String jobtitle=jobDocket.getParticulars();
int jobid=jobDocket.getJobDocketId();
// String jobdocketid = Integer.toString(jobid);
String jobdocketid = Integer.toString(jobid);
System.out.println("The jobdocketid is:"+jobdocketid);
String isbn=jobDocket.getIsbn();
int qtys = jobDocket.getNoofbooks();
String Qty= Integer.toString(qtys);
int noofpgs = jobDocket.getNoofpages();
String pgs = Integer.toString(noofpgs);
//
double noofshts = jobDocket.getNoofsheets();
String noofsheets = Double.toString(noofshts);
int pltextnt = jobDocket.getPlateextent();
String extentplate = Integer.toString(pltextnt);
int txtcolor = jobDocket.getBookcolor();
System.out.println("The text ");
// int txtcolor = Integer.parseInt(textcolor);
System.out.println("The book color is:"+txtcolor);
int d = 0;
int ttlpgs = noofpgs + d;
String clrtotlpgs = Integer.toString(ttlpgs);
int totalpgs = noofpgs + pltextnt;
System.out.println("The total no of pages is:"+totalpgs);
String pagestotal = Integer.toString(totalpgs);
// BarcodePDF417 pdf417 = new BarcodePDF417();
// String text = "BarcodePDF417 barcode";
// pdf417.setText(text);
// Image img = pdf417.getImage();
//// document.add(img);
// upperTable1.addCell(img);
// upperTable1.getDefaultCell().setRowspan(1);
// upperTable1.getDefaultCell().setRowspan(2);
Barcode128 code128 = new Barcode128();
code128.setGenerateChecksum(true);
code128.setCode(jobdocketid);
code128.setX(5.0f);
code128.setBarHeight(75.0f);
upperTable1.addCell(code128.createImageWithBarcode(writer.getDirectContent(), BaseColor.BLACK, BaseColor.GRAY));
// document.add(code128.createImageWithBarcode(writer.getDirectContent(), BaseColor.BLACK, BaseColor.GRAY));
// BarcodeQRCode my_code = new BarcodeQRCode("ClientName : "+clientName+"\n"+"jobtitle : "+jobtitle+"\n"+"JobDocketID : "+jobid+"\n"+"ISBN : "+isbn+"\n"+"Quantity : "+Qty,900,250, null);
// Image qr_image = my_code.getImage();
// upperTable1.addCell(qr_image);
// upperTable1.getDefaultCell().setColspan(1);
String clientName=jobDocket.getClientname().toLowerCase();
// upperTable1.addCell(new Phrase("Client:",f5));
// upperTable1.addCell(new Phrase(clientName,f5));
// upperTable1.addCell(new Phrase("",f6));
upperTable1.addCell(new Phrase("ISBN : "+jobDocket.getIsbn(),f6));
// upperTable1.getDefaultCell().setColspan(2);
// upperTable1.addCell(new Phrase(,f5));
// upperTable1.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
upperTable1.addCell(new Phrase("",f6));
// upperTable1.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
upperTable1.addCell(new Phrase("Title : "+jobtitle,f5));
// upperTable1.getDefaultCell().setColspan(2);
upperTable1.addCell(new Phrase("",f5));
// upperTable1.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
// upperTable1.addCell(new Phrase("",f6));
upperTable1.writeSelectedRows(0,-1,40,684,cb1);
upperTable1.flushContent();
document.add(upperTable1);
upperTable1.flushContent();
// PdfPCell cell21 = upperTable8.getDefaultCell();
BaseColor myColor = WebColors.getRGBColor("#000000");
// cell21.setBackgroundColor(myColor);
upperTable8.setTotalWidth(515);
upperTable8.setWidthPercentage(100.0f);
upperTable8.setWidths(new float[] {18,8,8,8,15,6,17,11});
upperTable8.setSpacingBefore(5);
upperTable8.getDefaultCell().setPadding(3);
upperTable8.getDefaultCell().setHorizontalAlignment(Element.ALIGN_MIDDLE);
upperTable8.addCell(new Phrase("Jobdocket Details :",f9));
upperTable8.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
PdfPCell cell99 = new PdfPCell(new Phrase("Sales", f3));
cell99.setBackgroundColor(myColor);
upperTable8.addCell(cell99);
upperTable8.addCell(new Phrase("Type :",f9));
upperTable8.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
PdfPCell cell98 = new PdfPCell(new Phrase("Manual", f3));
cell98.setBackgroundColor(myColor);
upperTable8.addCell(cell98);
upperTable8.addCell(new Phrase("ISBN Status :",f9));
upperTable8.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
PdfPCell cell97 = new PdfPCell(new Phrase(jobDocket.getIsbnstatus(), f3));
cell97.setBackgroundColor(myColor);
upperTable8.addCell(cell97);
upperTable8.addCell(new Phrase("Urgent / Normal:",f9));
upperTable8.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
PdfPCell cell96 = new PdfPCell(new Phrase(jobDocket.getUrgent_normal(), f3));
cell96.setBackgroundColor(myColor);
upperTable8.addCell(cell96);
upperTable8.writeSelectedRows(0,-1,40,587,cb1);
upperTable8.flushContent();
document.add(upperTable8);
upperTable8.flushContent();
/* PdfPCell cell21 = upperTable2.getDefaultCell();
upperTable2.setWidths(new float[] {22,18,20,20});
upperTable2.setTotalWidth(515);
upperTable2.getDefaultCell().setHorizontalAlignment(Element.ALIGN_MIDDLE);
upperTable2.getDefaultCell().setPadding(3);
// upperTable2.getDefaultCell().setBackgroundColor(BaseColor.GRAY);
upperTable2.addCell(new Phrase(" JobDocket Details-Sales ",f9));
upperTable2.addCell(new Phrase(" Type : Manual",f9));
// upperTable2.getDefaultCell().setRowspan(3); //Commented by emp1 on 25-05-2017 for checking purpose
BaseColor myColor = WebColors.getRGBColor("#000000");
cell21.setBackgroundColor(myColor);
upperTable2.addCell(new Phrase(" ISBN Status : "+jobDocket.getIsbnstatus(),f3));
// upperTable2.addCell(cell21);
upperTable2.addCell(new Phrase("Urgent / Normal",f3));
upperTable2.writeSelectedRows(0,-1,40,617,cb1);
upperTable2.flushContent();
document.add(upperTable2);
upperTable2.flushContent(); */
String statusofisbn = jobDocket.getIsbnstatus();
// Table created with one column
table2.setTotalWidth(515);
table2.setWidthPercentage(100.0f);
PdfPCell cell34 = table2.getDefaultCell();
cell34.setBorder(Rectangle.NO_BORDER);
table2.setWidths(new float[] {20,16,16,16,16,16});
// table2.getDefaultCell().setHorizontalAlignment(Element.ALIGN_MIDDLE);
table2.setSpacingBefore(5);
table2.getDefaultCell().setPadding(3);
// table2.setSpacingBefore(5);
// table2.setTotalWidth(515);
// table2.setWidths(new float[]{22, 26, 26,22});
// table2.setWidthPercentage(100);
// table2.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
// table2.setSpacingBefore(5);
// table2.getDefaultCell().setPadding(3);
//
//Table created with 8 columns
table.setTotalWidth(515);
table.setWidthPercentage(100.0f);
table.setWidths(new float[] {6,6,8,16,7,20,11,13});
table.setSpacingBefore(5);
table.getDefaultCell().setPadding(3);
// Table 3 created with 8 columns
table3.setTotalWidth(515);
table3.setWidthPercentage(100.0f);
table3.setWidths(new float[] {6,6,8,16,7,20,11,13});
table3.setSpacingBefore(5);
table3.getDefaultCell().setPadding(3);
// Table 14 created with 2 columns
table14.setTotalWidth(515);
table14.setWidthPercentage(100.0f);
table14.setWidths(new float[] {20,80});
table14.setSpacingBefore(5);
table14.getDefaultCell().setPadding(3);
// Table 15 created with 1 columns
table15.setTotalWidth(515);
table15.setWidthPercentage(100.0f);
table15.setWidths(new float[] {20,16,16,16,16,16});
table15.setSpacingBefore(5);
table15.getDefaultCell().setPadding(3);
//Table 4 created with 4 columns
table4.setTotalWidth(515);
table4.setWidthPercentage(100.0f);
table4.setWidths(new float[] {28,18,28,18});
table4.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
table4.setSpacingBefore(5);
table4.getDefaultCell().setPadding(3);
//
// //Table 5 created with 4 columns
table5.setTotalWidth(515);
table5.setWidthPercentage(100.0f);
table5.setWidths(new float[] {28,18,28,18});
table5.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
table5.setSpacingBefore(5);
table5.getDefaultCell().setPadding(3);
// //Table 8 created with 4 columns
table8.setTotalWidth(515);
table8.setWidthPercentage(100.0f);
table8.setWidths(new float[] {26,30,20,20});
table8.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
table8.setSpacingBefore(5);
table8.getDefaultCell().setPadding(3);
//Table 9 created with 4 columns
table9.setTotalWidth(515);
table9.setWidthPercentage(100.0f);
table9.setWidths(new float[] {26,30,20,20});
table9.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
table9.setSpacingBefore(5);
table9.getDefaultCell().setPadding(3);
//Table 12 created with 4 columns
// table12.setTotalWidth(515);
// table12.setWidthPercentage(100.0f);
// table12.setWidths(new float[] {22,22,22,22});
// table12.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
// table12.setSpacingBefore(5);
// table12.getDefaultCell().setPadding(3);
//Table 13 created with 4 columns
// table13.setTotalWidth(515);
// table13.setWidthPercentage(100.0f);
// table13.setWidths(new float[] {22,22,22,22}); //commented by emp1 on 26-05-2017
// table13.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
// table13.setSpacingBefore(5);
// table13.getDefaultCell().setPadding(3);
// PdfPCell cell = table.getDefaultCell();
// cell.setBorder(Rectangle.NO_BORDER);
// PdfPCell cell11 = table4.getDefaultCell();
// cell11.setBorder(Rectangle.NO_BORDER);
// PdfPCell cell12 = table4.getDefaultCell();
// cell12.setBorder(Rectangle.NO_BORDER);
int insertfrom = jobDocket.getPlateinsertfrom();
String plateinsertfrom = Integer.toString(insertfrom);
System.out.println("The Plate Insert from is:"+plateinsertfrom);
int insertto = jobDocket.getPlateinsertto();
String plateinsertto= Integer.toString(insertto);
System.out.println("The Plate Insert from is:"+plateinsertto);
// int wghtplt = jobDocket.plate;
// String weightplate = Integer.toString(wghtplt);
BaseColor myColor6 = WebColors.getRGBColor("#000000");
PdfPCell cell79 = new PdfPCell(new Phrase("No of Pages", f3));
cell79.setBackgroundColor(myColor6);
table2.addCell(cell79);
table2.addCell(new Phrase("",f2));
table2.addCell(new Phrase("",f2));
table2.addCell(new Phrase("",f2));
table2.addCell(new Phrase("",f2));
table2.addCell(new Phrase("",f2));
table.addCell(new Phrase("CLR",f2));
if(txtcolor == 4){
table3.addCell(new Phrase(pgs,f11));
}
else{
table3.addCell(new Phrase(extentplate,f11));
}
table.addCell(new Phrase("B/W",f2));
if(txtcolor == 4){
table3.addCell(new Phrase("0",f11));
}
else{
table3.addCell(new Phrase(pgs,f11));
}
table.addCell(new Phrase("Total",f2));
if(txtcolor == 4){
table3.addCell(new Phrase(clrtotlpgs,f11));
}
else{
table3.addCell(new Phrase(pagestotal,f11));
}
//table2.getDefaultCell().setColspan(4);
//table2.addCell(new Phrase("No of Pages",f2));
//table.addCell(table2);
//table2 = new PdfPTable(4);
table.addCell(new Phrase("Finish Size",f2));
table3.addCell(new Phrase(jobDocket.getSize_inches(),f11));
table4.addCell(new Phrase("Inner Paper", f2));
table5.addCell(new Phrase(jobDocket.getPaperquality(),f11));
table8.addCell(new Phrase("Binding Type", f2));
table9.addCell(new Phrase(jobDocket.getBinding(),f4));
table.addCell(new Phrase("Qty",f2));
table3.addCell(new Phrase(Qty,f11));
table4.addCell(new Phrase("Insert Colors", f2));
table5.addCell(new Phrase(jobDocket.getPlateinformation(),f11));
table8.addCell(new Phrase("Cover Pages", f2));
table9.addCell(new Phrase(jobDocket.getCovergsm(),f4));
table.addCell(new Phrase("Feeding Size",f2));
table3.addCell(new Phrase(jobDocket.getSize(), f11));
table4.addCell(new Phrase("Insert Paper", f2));
table5.addCell(new Phrase(jobDocket.getColorgsm(), f11));
table8.addCell(new Phrase("Dust Cover", f2));
table9.addCell(new Phrase(jobDocket.getDustjocket(), f4));
table.addCell(new Phrase("Total Sheets",f2));
table3.addCell(new Phrase(noofsheets, f11));
table.addCell(new Phrase("Media",f2));
table3.addCell(new Phrase(jobDocket.getMedia(), f11));
PdfPCell cell78 = new PdfPCell(new Phrase("Special Instruction", f3));
cell78.setBackgroundColor(myColor6);
table14.addCell(cell78);
//table14.addCell(new Phrase("Special Instruction",f2));
table14.addCell(new Phrase(jobDocket.getSpecial_instruction(), f11));
PdfPCell cell33 = table15.getDefaultCell();
cell33.setBorder(Rectangle.NO_BORDER);
PdfPCell cell77 = new PdfPCell(new Phrase("Paper Details", f3));
cell77.setBackgroundColor(myColor6);
table15.addCell(cell77);
table15.addCell(new Phrase("",f2));
table15.addCell(new Phrase("",f2));
table15.addCell(new Phrase("",f2));
table15.addCell(new Phrase("",f2));
table15.addCell(new Phrase("",f2));
//table15.addCell(new Phrase("Paper Details",f2));
table4.addCell(new Phrase("Insert From / To", f2));
table5.addCell(new Phrase(plateinsertfrom+" - "+plateinsertto, f11));
table8.addCell(new Phrase("Lamination", f2));
table9.addCell(new Phrase(jobDocket.getLamination(), f4));
// int insertto = jobDocket.getPlateinsert_to();
// String plateinsertto = Integer.toString(insertto);
//
// table.addCell(new Phrase("Plate Insert To",f2));
// table.addCell(new Phrase(":"));
// table.addCell(new Phrase(plateinsertto));
//
// int pltextnt = jobDocket.getPlateExtent();
// String extentplate = Integer.toString(pltextnt);
//
// table.addCell(new Phrase("Plate Extent",f2));
// table.addCell(new Phrase(":"));
// table.addCell(new Phrase(extentplate));
//
// table.addCell(new Phrase("Paper GSM",f2));
// table.addCell(new Phrase(":"));
// table.addCell(new Phrase(jobDocket.getPaperquality()));
//
// table.addCell(new Phrase("Cover GSM",f2));
// table.addCell(new Phrase(":"));
// table.addCell(new Phrase(jobDocket.getCovergsm()));
//
// table.addCell(new Phrase("Binding",f2));
// table.addCell(new Phrase(":"));
// table.addCell(new Phrase(jobDocket.getBinding()));
//
// table.addCell(new Phrase("Lamination",f2));
// table.addCell(new Phrase(":"));
// table.addCell(new Phrase(jobDocket.getLamination()));
//
// table.addCell(new Phrase("Media",f2)); // commented by emp1 on 11-05-2017
// table.addCell(new Phrase(":"));
// table.addCell(new Phrase(jobDocket.getMedia()));
table2.writeSelectedRows(0,-1,40,569,cb2);
table2.flushContent();
document.add(table2);
table2.flushContent();
//
//
table.writeSelectedRows(0,-1,40,552,cb2);
table.flushContent();
document.add(table);
table.flushContent();
table3.writeSelectedRows(0,-1,40,535,cb2);
table3.flushContent();
document.add(table3);
table3.flushContent();
table14.writeSelectedRows(0,-1,40,515,cb2);
table14.flushContent();
document.add(table14);
table14.flushContent();
table15.writeSelectedRows(0,-1,40,490,cb2);
table15.flushContent();
document.add(table15);
table15.flushContent();
//
table4.writeSelectedRows(0,-1,40,473,cb2);
table4.flushContent();
document.add(table4);
table4.flushContent();
//
table5.writeSelectedRows(0,-1,40,456,cb2);
table5.flushContent();
document.add(table5);
table5.flushContent();
table8.writeSelectedRows(0,-1,40,437,cb2);
table8.flushContent();
document.add(table8);
table8.flushContent();
table9.writeSelectedRows(0,-1,40,420,cb2);
table9.flushContent();
document.add(table9);
table9.flushContent();
// table12.writeSelectedRows(0,-1,40,493,cb2);
// table12.flushContent();
// document.add(table12);
// table12.flushContent();
//
// table13.writeSelectedRows(0,-1,40,475,cb2);
// table13.flushContent();
// document.add(table13);
// table13.flushContent();
//
// table5.writeSelectedRows(0,-1,40,535,cb2);
// table5.flushContent();
// document.add(table5);
// table5.flushContent();
// if(list.size()!=0 && jobDocketDesign.size()==0) //commented on 02-02-2017 for checking purpose
if(list.size()!=0)
{
System.out.println("To check Jobid condition");
upperTable2.setWidths(new float[] {22,18,20,20});
upperTable2.setTotalWidth(515);
upperTable2.getDefaultCell().setHorizontalAlignment(Element.ALIGN_MIDDLE);
upperTable2.getDefaultCell().setPadding(3);
upperTable2.getDefaultCell().setBackgroundColor(BaseColor.GRAY);
upperTable2.addCell(new Phrase("PREPRESS DETAILS",f3));
upperTable2.addCell(new Phrase(" ",f3));
upperTable2.addCell(new Phrase(" ",f3));
upperTable2.addCell(new Phrase(" ",f3));
upperTable2.writeSelectedRows(0,-1,40,398,cb1);
upperTable2.flushContent();
document.add(upperTable2);
upperTable2.flushContent();
// Table created with 6 columns
table6.setTotalWidth(515);
table6.setWidthPercentage(100.0f);
table6.setWidths(new float[] {16,16,6,19,19,19});
table6.setSpacingBefore(5);
table6.getDefaultCell().setPadding(3);
// //Table 7 created with 1 columns
// table7.setTotalWidth(515);
// table7.setWidthPercentage(100.0f);
// table7.setWidths(new float[] {16,16,6,19,19,19});
// table7.setSpacingBefore(5);
// table7.getDefaultCell().setPadding(3);
// JobDocketDesign jobD = (JobDocketDesign) list.get(1);
// upperTable.addCell(new Phrase("Inner : "+list.get(2)));
// upperTable.addCell(new Phrase("Cover : "+list.get(3)));
int noofupss = jobDocket.getNoofups();
String ups = Integer.toString(noofupss);
table6.addCell(new Phrase("Book Finish Size",f2));
table6.addCell(new Phrase("Feeding Size",f2));
table6.addCell(new Phrase("Ups",f2));
table6.addCell(new Phrase("Full Signature",f2));
table6.addCell(new Phrase("Half Signature",f2));
table6.addCell(new Phrase("Quarter Signature",f2));
table6.addCell(new Phrase(jobDocket.getSize_inches(),f11));
table6.addCell(new Phrase(jobDocket.getSize(),f11));
table6.addCell(new Phrase(ups,f11));
table6.addCell(new Phrase("",f4));
table6.addCell(new Phrase("",f4));
table6.addCell(new Phrase("",f4));
// table.addCell(new Phrase("Special Pages",f2));
// table.addCell(new Phrase(":"));
// table.addCell(new Phrase(jobD.getSpecialPages()));
// table.addCell(new Phrase("Null"));
//
// table.addCell(new Phrase("Others",f2));
// table.addCell(new Phrase(":"));
//// table.addCell(new Phrase(jobD.getOthers()));
// table.addCell(new Phrase("Null"));
//
// table.addCell(new Phrase("W. Board Size",f2));
// table.addCell(new Phrase(":"));
//// table.addCell(new Phrase(jobD.getWrapperBoardSize()));
// table.addCell(new Phrase("Null"));
//
// table.addCell(new Phrase("Print Ready File",f2));
// table.addCell(new Phrase(":"));
//// table.addCell(new Phrase(jobD.getPrintReadyPath()));
// table.addCell(new Phrase("Null"));
table6.writeSelectedRows(0,-1,40,378,cb2);
table6.flushContent();
document.add(table6);
table6.flushContent();
// table7.writeSelectedRows(0,-1,40,413,cb2);
// table7.flushContent();
// document.add(table7);
// table7.flushContent();
}
// To get JobDocketDesign Values In PDF
else
{
if(Jds.contains(jobDocket.getJobDocketId()))
{
// for(JobDocketDesign jobD:jobDocketDesign)
// {
// System.out.println("The JobDocket Sales "+jobDocket.getJobDocketId());
// System.out.println("The JobDocket Design "+jobD.getJobDocketId());
// if(jobD.getJobDocketId()==jobDocket.getJobDocketId())
// {
// System.out.println("It Come to Else Condition");
// upperTable2.setWidths(new float[] {22,18,20,20});
// upperTable2.setTotalWidth(515);
// upperTable2.getDefaultCell().setHorizontalAlignment(Element.ALIGN_MIDDLE);
// upperTable2.getDefaultCell().setPadding(3);
// upperTable2.getDefaultCell().setBackgroundColor(BaseColor.GRAY);
// upperTable2.addCell(new Phrase("JobDocket Details-Design",f3));
//
//// System.out.println("The Inner File "+inner1+" Cover File "+cover1);
//
//// if(inner1.contains("Null"))
//// {
//// System.out.println("Test Inner If");
//// for(String inner:inner1)
//// {
//// if(inner=="Null" && jobD.getInnerFileProcessedBy()==0)
//// {
//// upperTable2.addCell(new Phrase("Inner :"+inner));
//// System.out.println("The If Condition of inner"+inner);
//// }
//// else if(inner!="Null" &&jobD.getInnerFileProcessedBy()!=0)
//// {
//// upperTable2.addCell(new Phrase("Inner :"+inner));
//// System.out.println("The else If Condition of inner"+inner);
//// }
//// }
//// }
//// else if(inner1.contains("comp"))
//// {
//// System.out.println("Test Last Inner Else");
//// for(String inner:inner1)
//// {
//// if(inner!="Null" && jobD.getInnerFileProcessedBy()!=0 )
//// {
//// upperTable2.addCell(new Phrase("Inner :"+inner));
//// System.out.println("The Else Contain if Condition of inner"+inner);
//// }
//// else if(inner=="Null" && jobD.getInnerFileProcessedBy()==0)
//// {
//// upperTable2.addCell(new Phrase("Inner :"+inner));
//// System.out.println("The If Condition of inner"+inner);
//// }
//// }
//// }
////
//
//// else
//// {
//// upperTable.addCell(new Phrase("Inner Null :Null"));
//// System.out.println("The Else Condition of inner");
//// }
////
//// for(String cover:cover1)
//// {
//// if(cover!="Null")
//// {
//// upperTable.addCell(new Phrase("Cover : "+cover));
//// System.out.println("The If Condition Cover");
//// }
//// else
//// {
//// upperTable.addCell(new Phrase("Cover : Null"));
//// System.out.println("The else Condition Cover");
//// }
//// }
////
//
// upperTable2.addCell(new Phrase("Inner : "+jobD.getInnerFileProcessedBy(),f3));
// upperTable2.addCell(new Phrase("Cover : "+jobD.getCoverFileProcessedBy(),f3));
// upperTable2.addCell(new Phrase(" ",f3));
// upperTable2.writeSelectedRows(0,-1,40,450,cb1);
// upperTable2.flushContent();
// document.add(upperTable2);
// upperTable2.flushContent();
//
// table.addCell(new Phrase("Book Size",f2));
// table.addCell(new Phrase(":"));
// table.addCell(new Phrase(jobD.getBookSize()));
//
// table.addCell(new Phrase("P. Feeding Size",f2));
// table.addCell(new Phrase(":"));
// table.addCell(new Phrase(jobD.getPaperFeedingSize()));
//
//
// table.addCell(new Phrase("Ups",f2));
// table.addCell(new Phrase(":"));
// table.addCell(new Phrase(jobD.getUps()));
//
//
// table.addCell(new Phrase("Full Signature",f2));
// table.addCell(new Phrase(":"));
// table.addCell(new Phrase(jobD.getFullSignature()));
//
//
// table.addCell(new Phrase("Half Signature",f2));
// table.addCell(new Phrase(":"));
// table.addCell(new Phrase(jobD.getHalfSignature()));
//
//
// table.addCell(new Phrase("Quarter Signature",f2));
// table.addCell(new Phrase(":"));
// table.addCell(new Phrase(jobD.getQuaterSignature()));
//
//
// table.addCell(new Phrase("Special Pages",f2));
// table.addCell(new Phrase(":"));
// table.addCell(new Phrase(jobD.getSpecialPages()));
//
//
// table.addCell(new Phrase("Others",f2));
// table.addCell(new Phrase(":"));
// table.addCell(new Phrase(jobD.getOthers()));
//
//
// table.addCell(new Phrase("W. Board Size",f2));
// table.addCell(new Phrase(":"));
// table.addCell(new Phrase(jobD.getWrapperBoardSize()));
//
//
// table.addCell(new Phrase("Print Ready File",f2));
// table.addCell(new Phrase(":"));
// table.addCell(new Phrase(jobD.getPrintReadyPath()));
// }
// }
}
else
{
System.out.println(" last Else condition");
// upperTable2.setWidths(new float[] {22,18,20,20});
// upperTable2.setTotalWidth(515);
// upperTable2.getDefaultCell().setHorizontalAlignment(Element.ALIGN_MIDDLE);
// upperTable2.getDefaultCell().setPadding(3);
// upperTable2.getDefaultCell().setBackgroundColor(BaseColor.GRAY);
// upperTable2.addCell(new Phrase(" JobDocket Details-Design",f3));
// upperTable2.addCell(new Phrase("Inner : Null ",f3));
// upperTable2.addCell(new Phrase("Cover : Null ",f3));
// upperTable2.addCell(new Phrase(" ",f3));
// upperTable2.writeSelectedRows(0,-1,40,450,cb1);
// upperTable2.flushContent();
// document.add(upperTable2);
// upperTable2.flushContent();
// JobDocketDesign jobD = (JobDocketDesign) list.get(1);
// upperTable.addCell(new Phrase("Inner : "+list.get(2)));
// upperTable.addCell(new Phrase("Cover : "+list.get(3)));
// table.addCell(new Phrase("Book Size",f2));
// table.addCell(new Phrase(":"));
// // table.addCell(new Phrase(jobD.getBookSize()));
// table.addCell(new Phrase("Null"));
//
//
// table.addCell(new Phrase("P. Feeding Size",f2));
// table.addCell(new Phrase(":"));
//// table.addCell(new Phrase(jobD.getPaperFeedingSize()));
// table.addCell(new Phrase("Null"));
//
// table.addCell(new Phrase("Ups",f2));
// table.addCell(new Phrase(":"));
//// table.addCell(new Phrase(jobD.getUps()));
// table.addCell(new Phrase("Null"));
//
// table.addCell(new Phrase("Full Signature",f2));
// table.addCell(new Phrase(":"));
//// table.addCell(new Phrase(jobD.getFullSignature()));
// table.addCell(new Phrase("Null"));
//
// table.addCell(new Phrase("Half Signature",f2));
// table.addCell(new Phrase(":"));
//// table.addCell(new Phrase(jobD.getHalfSignature()));
// table.addCell(new Phrase("Null"));
//
// table.addCell(new Phrase("Quarter Signature",f2));
// table.addCell(new Phrase(":"));
//// table.addCell(new Phrase(jobD.getQuaterSignature()));
// table.addCell(new Phrase("Null"));
//
// table.addCell(new Phrase("Special Pages",f2));
// table.addCell(new Phrase(":"));
//// table.addCell(new Phrase(jobD.getSpecialPages()));
// table.addCell(new Phrase("Null"));
////
// table.addCell(new Phrase("Others",f2));
// table.addCell(new Phrase(":"));
//// table.addCell(new Phrase(jobD.getOthers()));
// table.addCell(new Phrase("Null"));
//
// table.addCell(new Phrase("W. Board Size",f2));
// table.addCell(new Phrase(":"));
//// table.addCell(new Phrase(jobD.getWrapperBoardSize()));
// table.addCell(new Phrase("Null"));
//
// table.addCell(new Phrase("Print Ready File",f2));
// table.addCell(new Phrase(":"));
//// table.addCell(new Phrase(jobD.getPrintReadyPath()));
// table.addCell(new Phrase("Null"));
}
// table.writeSelectedRows(0,-1,40,430,cb2);
// table.flushContent();
// document.add(table);
// table.flushContent();
}
//Digital Printing
System.out.println("The list size is:"+list.size());
if(list.size() != 0){
upperTable4.setWidths(new float[] {98});
upperTable4.setTotalWidth(515);
upperTable4.getDefaultCell().setHorizontalAlignment(Element.ALIGN_MIDDLE);
upperTable4.getDefaultCell().setPadding(3);
upperTable4.getDefaultCell().setBackgroundColor(BaseColor.GRAY);
upperTable4.addCell(new Phrase("Digital Printing",f3));
upperTable4.writeSelectedRows(0,-1,40,340,cb3);
upperTable4.flushContent();
document.add(upperTable4);
upperTable4.flushContent();
// Table16 created with 6 columns
table16.setTotalWidth(515);
table16.setWidthPercentage(100.0f);
table16.setWidths(new float[] {16,14,14,14,18,19});
table16.setSpacingBefore(5);
table16.getDefaultCell().setPadding(3);
table16.addCell(new Phrase("Machine Name",f2));
table16.addCell(new Phrase("Received. Time /Date",f2));
table16.addCell(new Phrase("Start. Time / Date",f2));
table16.addCell(new Phrase("End. Time / Date",f2));
table16.addCell(new Phrase("No of Copies Received",f2));
table16.addCell(new Phrase("Wastages",f2));
table16.addCell(new Phrase(" ",f4));
table16.addCell(new Phrase(" ",f4));
table16.addCell(new Phrase(" ",f4));
table16.addCell(new Phrase(" ",f4));
table16.addCell(new Phrase(" ",f4));
table16.addCell(new Phrase(" ",f4));
}
table16.writeSelectedRows(0,-1,40,320,cb2);
table16.flushContent();
document.add(table16);
table16.flushContent();
//QC Table
if(list.size() != 0){
upperTable5.setWidths(new float[] {98});
upperTable5.setTotalWidth(515);
upperTable5.getDefaultCell().setHorizontalAlignment(Element.ALIGN_MIDDLE);
upperTable5.getDefaultCell().setPadding(3);
upperTable5.getDefaultCell().setBackgroundColor(BaseColor.GRAY);
upperTable5.addCell(new Phrase("QC",f3));
upperTable5.writeSelectedRows(0,-1,40,274,cb3);
upperTable5.flushContent();
document.add(upperTable5);
upperTable5.flushContent();
// Table17 created with 6 columns
table17.setTotalWidth(515);
table17.setWidthPercentage(100.0f);
table17.setWidths(new float[] {16,16,14,16});
table17.setSpacingBefore(5);
table17.getDefaultCell().setPadding(3);
table17.addCell(new Phrase("Done By",f2));
table17.addCell(new Phrase("Received. Time /Date",f2));
table17.addCell(new Phrase("Start. Time /Date",f2));
table17.addCell(new Phrase("End. Time /Date",f2));
table17.addCell(new Phrase(" ",f4));
table17.addCell(new Phrase(" ",f4));
table17.addCell(new Phrase(" ",f4));
table17.addCell(new Phrase(" ",f4));
}
table17.writeSelectedRows(0,-1,40,254,cb2);
table17.flushContent();
document.add(table17);
table17.flushContent();
//QC Table
if(list.size() != 0){
upperTable6.setWidths(new float[] {98});
upperTable6.setTotalWidth(515);
upperTable6.getDefaultCell().setHorizontalAlignment(Element.ALIGN_MIDDLE);
upperTable6.getDefaultCell().setPadding(3);
upperTable6.getDefaultCell().setBackgroundColor(BaseColor.GRAY);
upperTable6.addCell(new Phrase("Binding",f3));
upperTable6.writeSelectedRows(0,-1,40,217,cb3);
upperTable6.flushContent();
document.add(upperTable6);
upperTable6.flushContent();
// Table17 created with 6 columns
table18.setTotalWidth(515);
table18.setWidthPercentage(100.0f);
table18.setWidths(new float[] {16,16,14,16,16});
table18.setSpacingBefore(5);
table18.getDefaultCell().setPadding(3);
table18.addCell(new Phrase("Done By",f2));
table18.addCell(new Phrase("Received. Time / Date",f2));
table18.addCell(new Phrase("Start. Time / Date",f2));
table18.addCell(new Phrase("End. Time / Date",f2));
table18.addCell(new Phrase("Open Signature",f2));
table18.addCell(new Phrase(" ",f4));
table18.addCell(new Phrase(" ",f4));
table18.addCell(new Phrase(" ",f4));
table18.addCell(new Phrase(" ",f4));
table18.addCell(new Phrase(" ",f4));
}
table18.writeSelectedRows(0,-1,40,197,cb2);
table18.flushContent();
document.add(table18);
table18.flushContent();
//Shipping Table
System.out.println("The list size is:"+list.size());
if(list.size() != 0){
upperTable3.setWidths(new float[] {98});
upperTable3.setTotalWidth(515);
upperTable3.getDefaultCell().setHorizontalAlignment(Element.ALIGN_MIDDLE);
upperTable3.getDefaultCell().setPadding(3);
upperTable3.getDefaultCell().setBackgroundColor(BaseColor.GRAY);
upperTable3.addCell(new Phrase("Billing DETAILS",f3));
// upperTable3.addCell(new Phrase("Inner : Null ",f3));
// upperTable3.addCell(new Phrase("Cover : Null ",f3));
// upperTable3.addCell(new Phrase(" ",f3));
upperTable3.writeSelectedRows(0,-1,40,160,cb3);
upperTable3.flushContent();
document.add(upperTable3);
upperTable3.flushContent();
//Table 10 created with 4 columns
table10.setTotalWidth(515);
table10.setWidthPercentage(100.0f);
table10.setWidths(new float[] {22,22,22,22});
table10.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
table10.setSpacingBefore(5);
table10.getDefaultCell().setPadding(3);
//Table 11 created with 4 columns
table11.setTotalWidth(515);
table11.setWidthPercentage(100.0f);
table11.setWidths(new float[] {22,22,22,22});
table11.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
table11.setSpacingBefore(5);
table11.getDefaultCell().setPadding(3);
table1.setTotalWidth(515);
table1.setWidthPercentage(100.0f);
table1.setWidths(new float[] {30,70});
table1.setSpacingBefore(5);
table1.getDefaultCell().setPadding(3);
table1.addCell(new Phrase("Shipping Details",f2));
// table1.addCell(new Phrase(":"));
table1.addCell(new Phrase(jobDocket.getShipto(), f4));
// table1.addCell(new Phrase("Null"));
}
table1.writeSelectedRows(0,-1,40,140,cb2);
table1.flushContent();
document.add(table1);
table1.flushContent();
table.flushContent();
document.newPage();
table.flushContent();
}
}
catch(Exception e)
{
System.out.println("The Exception is "+e);
e.printStackTrace();
}
document.close();
}
}
Comments
Post a Comment