<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
    <%@page import="com.csc.library.utility.DHMConvert" %>
    <%@page import="java.util.ArrayList" %>
    <%@page import="java.util.Iterator" %>
    <%@page import="java.util.Vector" %>
    <%@page import="java.util.*" %>
    <%@page import="com.csc.library.report.ReportUDF" %>
    <%@page import="javax.servlet.jsp.jstl.sql.Result" %>
    <%@page import="java.io.FileOutputStream" %>
    <%@page import="java.io.OutputStream" %>
    <%@page import="java.io.ByteArrayOutputStream" %>
    <%@page import="java.net.URLDecoder" %>
    <%@page import="java.text.DecimalFormat" %>
    <%@page import="java.net.URLEncoder" %>
    <%@page import="java.util.HashMap" %>
    <%@page import="java.text.SimpleDateFormat" %>
    <%@page import="java.util.Locale" %>
    <%@page import="java.util.Date" %>
    <%@page import="java.util.GregorianCalendar" %>
    <%@page import="com.csc.library.database.DataSet" %>
    <%@page import="com.csc.library.session.InitialInquiry" %>
    <%@page import="com.csc.library.session.InitialRecord" %>
    <%@page import="com.csc.library.session.DbInquiry" %>
    <%@page import="com.csc.library.session.DbRecord" %>
    <%@page import="com.csc.library.entry.HelpEntry" %>
    <%@page import="com.itextpdf.text.*" %>
    <%@page import="com.itextpdf.text.pdf.*" %>
    <%@page import="java.io.ByteArrayOutputStream" %>
    <%@page import="com.csc.library.session.InitialEnvironment" %>
    <%@page import="java.io.File" %>
    <%@page import="org.json.JSONArray" %>
    <%@page import="org.json.JSONObject" %>
    <%@page import="com.csc.library.utilities.*" %>
    <%@ page import="com.csc.library.databean.Simmapplicantwithgson" %>
    <%@ page import="com.csc.library.database.MyHashMap" %>
    <%@ page import="com.csc.library.utilities.gsonmapping.*" %>

    <jsp:useBean id="ApplicantPrint_KOKOTEL" class="com.csc.library.system.Task" scope="page"/>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8"/>
    <title>Report</title>
    </head>
    <body>
    <%
    ApplicantPrint_KOKOTEL.setChannel(request, response);
    HelpEntry screen = (HelpEntry) ApplicantPrint_KOKOTEL.process("HelpEntry", "MAPPLICANTHELP");
    CheckNull chk = new CheckNull();
    String filter = "APPLICANTID = '" + chk.chkNullString(request.getParameter("appid")) + "'";
    //    filter = "1=2";
    screen.setMaxLine(1);
    screen.inq.setFilter(filter);
    screen.process();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();//72
    Document document = new Document(PageSize.A4, 25, 25, 90, 0);// Left,Right,Top,Down
    float[] sizeColumn = new float[]{};

    //   PdfWriter.getInstance(document, baos);
    PdfWriter writer = PdfWriter.getInstance(document, baos);
    // add header and footer

    document.open();
    document.addTitle("Document Title");

    // Setting Fonts
    BaseFont bfWithFontAWesome = BaseFont.createFont(application.getRealPath("fonts/FontAwesome.otf"), BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
    BaseFont bf = BaseFont.createFont(application.getRealPath("fonts/Cordia.ttf"), BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
    BaseFont bfHead = BaseFont.createFont(application.getRealPath("fonts/Tahoma.ttf"), BaseFont.IDENTITY_H, BaseFont.EMBEDDED, true);
    Font font = new Font(bf, 11);
    Font fontTopic = new Font(bfHead, 13);  
    Font fontHead = new Font(bfHead, 13, Font.BOLD);
    Font fontHeadWhiteColor = new Font(bfHead, 12, Font.BOLD, new BaseColor(255, 255, 255));
    fontHead.setStyle(Font.BOLD);
    Font fontContent = new Font(bfHead, 10);
    Font fontContent01 = new Font(bfHead, 9);
    Font fontBoldContent = new Font(bfHead, 11, Font.BOLD);
    Font fontTitle = new Font(bfHead, 20, Font.BOLD);
    fontTitle.setStyle(Font.BOLD);
    Font fontAwesome = new Font(bfWithFontAWesome, 10);
    //setfonts
    Font font_C18B = new Font(bfHead, 18, Font.BOLD);
    Font font_C16B = new Font(bfHead, 16, Font.BOLD);
    Font font_C14B = new Font(bfHead, 14,Font.BOLD);
    Font font_C13B = new Font(bfHead, 13,Font.BOLD);
    Font font_C13N = new Font(bfHead, 13);
    Font font_C12B = new Font(bfHead, 12,Font.BOLD);
    Font font_C12N = new Font(bfHead, 12);
    Font font_C10B = new Font(bfHead, 10,Font.BOLD);
    Font font_C10N = new Font(bfHead, 10);
    Font font_C09N = new Font(bfHead, 9);
    Font font_C08B = new Font(bfHead, 8,Font.BOLD);
    Font font_C08N = new Font(bfHead, 8);
    Font linebreak = new Font(bfHead, 1);
    // set vlign middle
    String[] text2 = new String[2];
    Phrase content = new Phrase(new Chunk("",linebreak));
    Float fontSize = content.getFont().getSize();
    Float capHeight = content.getFont().getBaseFont().getFontDescriptor(BaseFont.CAPHEIGHT, fontSize);

    boolean hasData = false;
    if (screen.getInquiry().recCount() > 0) {
      hasData = true;
      screen.nextRec();
      screen.referLangOn();
      DbInquiry dbinq = null;
      int i = 0;
      
      Simmapplicantwithgson simmapplicantwithgson = (Simmapplicantwithgson) screen.inq.getCurrentDbRecord();
      // ----------------------------prefix------------------------------------
      String prefixTDesc = "";
      String prefixEDesc = "";
      String Sim_prefixID = simmapplicantwithgson.mapplicantPersonal.prefixid;
      DbInquiry inqmprefix = new InitialInquiry(screen.getUProfile()).getDbInquiry("mprefix");
      inqmprefix.setFilter("prefixid = '"+Sim_prefixID+"'");
      inqmprefix.refresh();
      while(inqmprefix.next()){
       // inqmprefix.referLangOn();
        prefixTDesc = inqmprefix.getString("tdesc");
        prefixEDesc = inqmprefix.getString("edesc");
      }
      String FullnameThai = prefixTDesc + simmapplicantwithgson.mapplicantPersonal.fname.tha + "   " + simmapplicantwithgson.mapplicantPersonal.lname.tha;
      String FullnameEng = prefixEDesc + simmapplicantwithgson.mapplicantPersonal.fname.eng + "   " + simmapplicantwithgson.mapplicantPersonal.lname.eng;
      String NickameThai = simmapplicantwithgson.mapplicantPersonal.nickname.tha ;
      String NickameEng = simmapplicantwithgson.mapplicantPersonal.nickname.eng ;
      //----------------------------END prefix------------------------------------

      //------------------------------------age------------------------------------
      String age_memployee = "";
      CscCalendar startDate = new CscCalendar( chk.chkNullString(simmapplicantwithgson.mapplicantPersonal.birthdate.substring(0,10),"2100-12-31"));
      CscCalendar endDate = new CscCalendar();
      CountAge count = new CountAge(screen.getUProfile().get("lang"));
      age_memployee = chk.chkNullString(count.getCountAges(startDate,endDate,true),"0");
      //------------------------------------end age------------------------------------
      //----------------------------SourceJOB------------------------------------
      String sourcejobDesc = "";
      String Sim_sourcejobID = "";
      if(simmapplicantwithgson.mapplicantOther.sourcejob.equals(null)||simmapplicantwithgson.mapplicantOther.sourcejob.equals("")){
        Sim_sourcejobID = "0";
      }
      else{
        Sim_sourcejobID = simmapplicantwithgson.mapplicantOther.sourcejob;
      }
      DbInquiry inqmsourcejob = new InitialInquiry(screen.getUProfile()).getDbInquiry("msourcejob");
      inqmsourcejob.setFilter("sourcejobid = '" + Sim_sourcejobID + "'");
      inqmsourcejob.refresh();
      while (inqmsourcejob.next()) {
        sourcejobDesc = inqmsourcejob.getString("tdesc");
      }
        String job_from =  chk.chkNullString(simmapplicantwithgson.mapplicantOther.sourcejob," ");
        String sourcejobExplain  = chk.chkNullString(simmapplicantwithgson.mapplicantOther.sourcejobExplain," ");
        String typejobfrom = "";
        String str_job_from0 = "";
        String str_job_from2 = "";
        String str_job_from3 = "";
        if (job_from.equalsIgnoreCase("2") || job_from.equalsIgnoreCase("3") ||job_from.equalsIgnoreCase("4") ||job_from.equalsIgnoreCase("5") ||job_from.equalsIgnoreCase("326") ){
          typejobfrom = "0";
          str_job_from0 =  sourcejobExplain;
        }
        //Career Fair
        else if(job_from.equalsIgnoreCase("7")){
          typejobfrom = "1";
        } 
        //Friend to Friend
        else if(job_from.equalsIgnoreCase("327")){
          typejobfrom = "2";
          str_job_from2 =  sourcejobExplain;
        }
        //line,Walk In,Facebook,Other"'6','8','10','9'"
        else if (job_from.equalsIgnoreCase("6") ||job_from.equalsIgnoreCase("8") ||job_from.equalsIgnoreCase("9") ||job_from.equalsIgnoreCase("10") ){
          typejobfrom = "3";
         
          if(job_from.equalsIgnoreCase("9")){
            str_job_from3 =  sourcejobExplain;
          }
          else{
            str_job_from3 =  sourcejobExplain;
          }
        }
      //----------------------------END SourceJOB------------------------------------
      //----------------------------national------------------------------------
      String nationaldesc = "";
      String Sim_nationalID = "";
      if(simmapplicantwithgson.mapplicantPersonal.nationalityid.equals(null) || simmapplicantwithgson.mapplicantPersonal.nationalityid.equals("")){
        Sim_nationalID = "0";
      }
      else{
        Sim_nationalID = simmapplicantwithgson.mapplicantPersonal.nationalityid;
      }
      DbInquiry inqmnational = new InitialInquiry(screen.getUProfile()).getDbInquiry("mnational");
      inqmnational.setFilter("nationalid = '" + Sim_nationalID + "'");
      inqmnational.refresh();

      while (inqmnational.next()) {
        inqmnational.referLangOn();
        nationaldesc = inqmnational.getString("tdesc");        
      }
      //----------------------------END national------------------------------------

      //----------------------------nationality------------------------------------
      String nationalityDesc = "";
      String Sim_nationalityID = "";    
      if(simmapplicantwithgson.mapplicantPersonal.nationalityid.equals(null)){
        Sim_nationalityID = "0";
      }
      else{
        Sim_nationalityID = simmapplicantwithgson.mapplicantPersonal.raceid;
      }

      DbInquiry inqMnationality = new InitialInquiry(screen.getUProfile()).getDbInquiry("Mnationality");
      inqMnationality.setFilter("nationalityid = '" + Sim_nationalityID + "'");
      inqMnationality.refresh();
      while (inqMnationality.next()) {
        inqMnationality.referLangOn();
        nationalityDesc = inqMnationality.getString("tdesc");      
      }
      //----------------------------END nationality------------------------------------

      // ----------------------------religion------------------------------------
      String religionDesc = "";
      String Sim_religionID = "";
      if(simmapplicantwithgson.mapplicantPersonal.religionid.equals(null)){
        Sim_religionID = "0";
      }
      else{
        Sim_religionID = simmapplicantwithgson.mapplicantPersonal.religionid;
      }
      DbInquiry inqmreligion = new InitialInquiry(screen.getUProfile()).getDbInquiry("mreligion");
      inqmreligion.setFilter("religionid = '"+Sim_religionID+"'");
      inqmreligion.refresh();
      while(inqmreligion.next()){
        inqmreligion.referLangOn();
        religionDesc = inqmreligion.getString("tdesc");
      }
      //----------------------------END religion------------------------------------

      //----------------------------SETDATA CONTACT ------------------------------------
      StringBuilder sc = new StringBuilder();
      sc.append(simmapplicantwithgson.mapplicantContact.current.addr);
      if (!simmapplicantwithgson.mapplicantContact.home.moo.equalsIgnoreCase("-")) {
        sc.append(" หมู่ " + simmapplicantwithgson.mapplicantContact.home.moo);
      }
      sc.append(" ถนน " + simmapplicantwithgson.mapplicantContact.home.road);
      //----------------------------END CONTACT------------------------------------
      //----------------------------SETDATA EDUCATION------------------------------------
      MyHashMap educationbackground = new MyHashMap();
      String[] masterdegree = {"1", "2", "3","4", "5", "6", "7", "8", "9"};
      String degreeDesc = " ";
      String majorDesc = " ";
      for (String degreekey : masterdegree) {
        educationbackground.put("name" + degreekey, " ");
        educationbackground.put("from" + degreekey, " ");
        educationbackground.put("to" + degreekey, " ");
        educationbackground.put("degree" + degreekey, " ");
        educationbackground.put("major" + degreekey, " ");
        educationbackground.put("gpa" + degreekey, " ");
      }
      DbInquiry inqdegree = new InitialInquiry(screen.getUProfile()).getDbInquiry("mdegree");
      DbInquiry inqmajor = new InitialInquiry(screen.getUProfile()).getDbInquiry("mmajor");
      for (MapplicantEducation.Education education : simmapplicantwithgson.mapplicantEducation.education) {    
        if (education.university.universitylist == null) {
          educationbackground.put("name" + education.degreetype,  chk.chkNullString(education.university.searchtext," "));
        } else {
          educationbackground.put("name" + education.degreetype,  chk.chkNullString(education.university.universitylist.name.tha," "));
        }
        if (education.major.majorlist == null) {
          educationbackground.put("major" + education.degreetype, chk.chkNullString(education.major.searchtext," "));
        }else {
          educationbackground.put("major" + education.degreetype, chk.chkNullString(education.major.majorlist.name.tha," "));
        }
        
        educationbackground.put("from" + education.degreetype,chk.chkNullString(education.yearstart.toString()," "));
        educationbackground.put("to" + education.degreetype, chk.chkNullString(education.yearend.toString()," "));
        educationbackground.put("gpa" + education.degreetype,chk.chkNullString( education.gpa.toString()," "));

        inqdegree.setFilter("degreeid = '" + education.degreetype + "'");
        inqdegree.refresh();
        while (inqdegree.next()) {
         degreeDesc = inqdegree.getString("tdesc");
        }
        educationbackground.put("degree" + education.degreetype,degreeDesc);
     }


      //----------------------------SET DATA Family------------------------------------
      //01 father ,02 mother ,03 Spouse's name ,99 emergency
      String son = chk.chkNullString(simmapplicantwithgson.mapplicantPersonal.children.sons,"0");
      String daughter = chk.chkNullString(simmapplicantwithgson.mapplicantPersonal.children.daughters,"0");
      int ChildAll = Integer.valueOf(son) + Integer.valueOf(daughter);
      MyHashMap familybackground = new MyHashMap();
      String[] masterrelations = {"01", "02", "03"};
      String occupationDesc = "";
      String relationDesc = "";
      String line = "";
      int childtotal = 0;
      int relativetotal = 0;
      for (String relatationkey : masterrelations) {
            familybackground.put("fname" + relatationkey, " ");
            familybackground.put("lname" + relatationkey, " ");
            familybackground.put("age" + relatationkey, " ");
            familybackground.put("relation" + relatationkey, " ");
            familybackground.put("occupation" + relatationkey, " ");
            familybackground.put("position" + relatationkey, " ");
            familybackground.put("status" + relatationkey, " ");
            familybackground.put("workplace" + relatationkey, " ");
            familybackground.put("phone" + relatationkey, " ");  
           
        }

      DbInquiry inqoccupation = new InitialInquiry(screen.getUProfile()).getDbInquiry("moccupation");
      DbInquiry inqrelation = new InitialInquiry(screen.getUProfile()).getDbInquiry("mrelation");
    
      for (MapplicantFamily.Family family : simmapplicantwithgson.mapplicantFamily.family) {
        inqoccupation.setFilter("occid = '" + family.occupation+ "'");
        inqoccupation.refresh();
        while (inqoccupation.next()) {
          inqoccupation.referLangOn();
          occupationDesc = inqoccupation.getString("tdesc");
        }

        inqrelation.setFilter("relationid = '" + family.relation+ "'");
        inqrelation.refresh();
        while (inqrelation.next()) {
          inqrelation.referLangOn();
          relationDesc = inqrelation.getString("tdesc");
        }
            familybackground.put("fname" + family.relation, chk.chkNullString(family.fname," "));
            familybackground.put("lname" + family.relation, chk.chkNullString(family.lname," "));
            familybackground.put("age" + family.relation, chk.chkNullString(family.age," "));
            familybackground.put("occupation" + family.relation, chk.chkNullString(occupationDesc," "));
            familybackground.put("relation" +  family.relation, chk.chkNullString(relationDesc," "));
            familybackground.put("position" + family.relation, chk.chkNullString(family.position," "));
            familybackground.put("status" + family.relation, chk.chkNullString(family.status," "));
            familybackground.put("workplace" + family.relation, chk.chkNullString(family.workplace," "));
            familybackground.put("phone" + family.relation, chk.chkNullString(family.phone," "));
      }

      //----------------------------END Family------------------------------------
      //----------------------------SET DATA Family LOOP VERTION ไม่จับจาก MASTERRELATIONS------------------------------------
      MyHashMap familybg = new MyHashMap();
      String occupationDesc2 = "";
      String relationDesc2 = "";
      String degreeDesc2 = "";
      int loopFamily = 1;
      for (int loopRelation = 1; loopRelation <= 7; loopRelation++) {
            familybg.put("fname" + loopRelation, " ");
            familybg.put("lname" + loopRelation, " ");
            familybg.put("age" + loopRelation, " ");
            familybg.put("relation" + loopRelation, " ");
            familybg.put("occupation" + loopRelation, " ");
            familybg.put("position" + loopRelation, " ");
            familybg.put("status" + loopRelation, " ");
            familybg.put("workplace" + loopRelation, " ");
            familybg.put("phone" + loopRelation, " ");   
            familybg.put("degreeid" + loopRelation, " ");   
        }
      DbInquiry inqoccupation2 = new InitialInquiry(screen.getUProfile()).getDbInquiry("moccupation");
      DbInquiry inqrelation2 = new InitialInquiry(screen.getUProfile()).getDbInquiry("mrelation");
      DbInquiry inqfamilydegree = new InitialInquiry(screen.getUProfile()).getDbInquiry("mdegree");
      
      for (MapplicantFamily.Family family : simmapplicantwithgson.mapplicantFamily.family) {
        inqoccupation2.setFilter("occid = '" + family.occupation+ "'");
        inqoccupation2.refresh();
        while (inqoccupation2.next()) {
          inqoccupation2.referLangOn();
          occupationDesc2 = inqoccupation2.getString("tdesc");
        }

        inqrelation2.setFilter("relationid = '" + family.relation+ "'");
        inqrelation2.refresh();
        while (inqrelation2.next()) {
          inqrelation2.referLangOn();
          relationDesc2 = inqrelation2.getString("tdesc");
        }
        inqfamilydegree.setFilter("degreeid = '" + family.degreeid+ "'");
        inqfamilydegree.refresh();
        while (inqfamilydegree.next()) {
          inqfamilydegree.referLangOn();
          degreeDesc2 = inqfamilydegree.getString("tdesc");
        }
            familybg.put("fname" + loopFamily, chk.chkNullString(family.fname," "));
            familybg.put("lname" + loopFamily, chk.chkNullString(family.lname," "));
            familybg.put("age" + loopFamily, chk.chkNullString(family.age," "));
            familybg.put("occupation" + loopFamily, chk.chkNullString(occupationDesc2," "));
            familybg.put("relation" +  loopFamily, chk.chkNullString(relationDesc2," "));
            familybg.put("position" + loopFamily, chk.chkNullString(family.position," "));
            familybg.put("status" + loopFamily, chk.chkNullString(family.status," "));
            familybg.put("workplace" + loopFamily, chk.chkNullString(family.workplace," "));
            familybg.put("phone" + loopFamily, chk.chkNullString(family.phone," "));
            familybg.put("degreeid" + loopFamily, chk.chkNullString(degreeDesc2," "));

            loopFamily++;
      }
      //----------------------------END Family LOOP VERTION ไม่จับจาก MASTERRELATIONS------------------------------------
      //----------------------------SETDATA COM REFERENCE ------------------------------------
       MyHashMap comreference = new MyHashMap();
      int roundcomreference = 0;
      for (int referencekey = 0; referencekey <= 5; referencekey++){
        comreference.put("name" + referencekey, " ");
        comreference.put("lname" + referencekey, " ");
      } 

   for (MapplicantOther.Referee_group ref_group : simmapplicantwithgson.mapplicantOther.referee_group) {
        comreference.put("name" + roundcomreference, chk.chkNullString(ref_group.name," "));
        comreference.put("lname" + roundcomreference,chk.chkNullString( ref_group.lname," "));
        roundcomreference++;
      }
     //----------------------------END COM REFERENCE-----------------------------------------
      DecimalFormat DFO = new DecimalFormat("#,###,###");
      DecimalFormat DFO_ietls = new DecimalFormat("#,###.##");
      //----------------------------SETDATA Skill ------------------------------------
      MyHashMap hmlangskill = new MyHashMap();
      //MyHashMap masterskilllevel = new MyHashMap();
      int langskillloop = 0;

      for(int initlangskill = 0; initlangskill <= 4; initlangskill++){
        hmlangskill.put("skillNameTdesc"+initlangskill, " ");
        hmlangskill.put("skillNameEdesc"+initlangskill, " ");
        hmlangskill.put("reading"+initlangskill, " ");
        hmlangskill.put("write"+initlangskill, " ");
        hmlangskill.put("speak"+initlangskill, " ");
        hmlangskill.put("listen"+initlangskill, " ");
        hmlangskill.put("searchtext"+initlangskill, " ");
      }
/*
      DbInquiry inqskilllevel = new InitialInquiry(screen.getUProfile()).getDbInquiry("mskilllevel");
      inqskilllevel.refresh();
      while(inqskilllevel.next()) {
        masterskilllevel.put(inqskilllevel.getString("skilllevelid"),inqskilllevel.getString("tdesc"));
      }
      */
      
  //    DbInquiry inqlangskill = new InitialInquiry(screen.getUProfile()).getDbInquiry("mlanguage");
      for (MapplicantSkill.Langskill langskill : simmapplicantwithgson.mapplicantSkill.langskill) {
   /*     inqlangskill.setFilter("languageid = '"+langskill.name+"'");
        inqlangskill.refresh();

        while(inqlangskill.next()) {
          inqlangskill.referLangOff();
          hmlangskill.put("skillNameTdesc"+langskillloop, inqlangskill.getString("tha"));
          hmlangskill.put("skillNameEdesc"+langskillloop, inqlangskill.getString("eng"));
        }
*/
        if(langskill.langskilllist ==null){
          hmlangskill.put("skillNameTdesc"+langskillloop, chk.chkNullString(langskill.searchtext," "));
        }
        else{
          hmlangskill.put("skillNameTdesc"+langskillloop, chk.chkNullString(langskill.langskilllist.name.tha," "));
          hmlangskill.put("skillNameEdesc"+langskillloop, chk.chkNullString(langskill.langskilllist.name.eng," "));
        }
    
        hmlangskill.put("reading"+langskillloop, chk.chkNullString(langskill.skill.reading," "));
        hmlangskill.put("write"+langskillloop, chk.chkNullString(langskill.skill.write," "));
        hmlangskill.put("speak"+langskillloop, chk.chkNullString(langskill.skill.speak," "));
        hmlangskill.put("listen"+langskillloop, chk.chkNullString(langskill.skill.listen," "));
        langskillloop++;
      }
     
      //----------------------------End Skill ----------------------------------------
      //----------------------------JSONArray activity ----------------------------------------
      MyHashMap hmactivity = new MyHashMap();
  /*    JSONArray activityAry = new JSONArray(simmapplicantwithgson.mapplicantSkill.activity);
      String activityList = "";

      for (int activityloop = 0 ; activityloop < activityAry.length() ; activityloop++) {
        activityList += activityAry.getJSONObject(activityloop).getString("name");
          if(activityloop + 1 < activityAry.length()){
              activityList += ",";
          }
      }
      */
      int langactivityloop = 0;

      for(int initlangskill = 0; initlangskill <= 4; initlangskill++){
        hmactivity.put("start"+initlangskill, " ");
        hmactivity.put("end"+initlangskill, " ");
        hmactivity.put("name"+initlangskill, " ");
        hmactivity.put("degreetype"+initlangskill, " ");
        hmactivity.put("role"+initlangskill, " ");
        hmactivity.put("roledesc"+initlangskill, " ");
      }

      for (MapplicantSkill.Activity activity : simmapplicantwithgson.mapplicantSkill.activity) {
        hmactivity.put("start"+langactivityloop, chk.chkNullString(activity.start," "));
        hmactivity.put("end"+langactivityloop, chk.chkNullString(activity.end," "));
        hmactivity.put("name"+langactivityloop, chk.chkNullString(activity.name," "));
        hmactivity.put("degreetype"+langactivityloop, chk.chkNullString(activity.degreetype," "));
        hmactivity.put("role"+langactivityloop, chk.chkNullString(activity.role," "));
        hmactivity.put("roledesc"+langactivityloop, chk.chkNullString(activity.roledesc," "));
        langactivityloop++;
      }
      //----------------------------END JSONArray activity ----------------------------------------
      //----------------------------Check Overtime & Work_country ----------------------------------------
        Boolean chk_overtime =simmapplicantwithgson.mapplicantOther.overtime.status;
        Boolean chk_workup_country =simmapplicantwithgson.mapplicantOther.workupcountry;
        String overtime="";
        if(chk_overtime == null)
        { overtime = "1";}
        else if(chk_overtime != null){
              if(chk_overtime)
              { overtime = "0";}
              else
              { overtime = "2";}
        }
        String workup_country="";
         if(chk_workup_country == null)
        { workup_country = "1";}
        else if(chk_workup_country != null){
              if(chk_workup_country)
              { workup_country = "0";}
              else
              { workup_country = "2";}
        }
      //----------------------------END Overtime & Work_country ----------------------------------------
      //----------------------------BLOOD ----------------------------------------
          String chk_blood  = simmapplicantwithgson.mapplicantPersonal.blood;

      //----------------------------JSONArray hobbies ----------------------------------------
      JSONArray hobbiesAry = new JSONArray(simmapplicantwithgson.mapplicantSkill.hobbies);
      String hobbieList = "";

      for (int hobbiesloop = 0 ; hobbiesloop < hobbiesAry.length() ; hobbiesloop++) {
        hobbieList += hobbiesAry.getString(hobbiesloop);
          if(hobbiesloop + 1 < hobbiesAry.length()){
              hobbieList += ",";
          }
      }
      //----------------------------END JSONArray hobbies ----------------------------------------
            //----------------------------JSONArray sport ----------------------------------------
      JSONArray sportAry = new JSONArray(simmapplicantwithgson.mapplicantSkill.sport);
      String sportList = "";

      for (int sportloop = 0 ; sportloop < sportAry.length() ; sportloop++) {
        sportList += sportAry.getString(sportloop);
          if(sportloop + 1 < sportAry.length()){
              sportList += ",";
          }
      }
      //----------------------------END JSONArray hobbies ----------------------------------------

      //----------------------------SETDATA JOPEXP------------------------------------
      MyHashMap jobexp = new MyHashMap();
      int roundjobexp = 0;
      for (int jobexpkey = 0; jobexpkey <= 5; jobexpkey++){
        jobexp.put("companyname_job" + jobexpkey, "");
        jobexp.put("start" + jobexpkey, "");
        jobexp.put("end" + jobexpkey, "");
        jobexp.put("title" + jobexpkey, "");
        jobexp.put("salary" + jobexpkey, "");
        jobexp.put("reason" + jobexpkey, "");
        jobexp.put("position" + jobexpkey , "");
        jobexp.put("description" + jobexpkey , "");

      }
      for (MapplicantJobexp.Job job : simmapplicantwithgson.mapplicantJobexp.job) {

        jobexp.put("companyname_job" + roundjobexp,chk.chkNullString(job.companyname," "));
        jobexp.put("start" + roundjobexp,new CscCalendar(chk.chkNullString(job.start," ").toString().substring(0,10)).getDDMMYYYY().replaceAll("-","/"));
        jobexp.put("end" + roundjobexp, new CscCalendar(chk.chkNullString(job.end," ").toString().substring(0,10)).getDDMMYYYY().replaceAll("-","/"));
        jobexp.put("title" + roundjobexp, chk.chkNullString(job.title," "));
        jobexp.put("salary" + roundjobexp, chk.chkNullString(job.salary," "));
        jobexp.put("reason" + roundjobexp, chk.chkNullString(job.reason," "));
        jobexp.put("present" + roundjobexp, job.present);
        jobexp.put("description" + roundjobexp,chk.chkNullString( job.description," "));

        if(job.allowances != null) {
          jobexp.put("position" + roundjobexp, job.allowances.position);
        } 
        roundjobexp++;
      }
      //  new CscCalendar(jobexp.get("end2").toString().substring(0,10)).getDDMMYYYY()
      //----------------------------END JOPEXP------------------------------------

      //----------------------------SETDATA REFERENCE ------------------------------------
      MyHashMap familyreference = new MyHashMap();
      int roundreference = 0;

      for (int referencekey = 0; referencekey <= 5; referencekey++){
        familyreference.put("name" + referencekey, "");
        familyreference.put("jobtitle" + referencekey, "");
        familyreference.put("dept" + referencekey, "");
        familyreference.put("companyname" + referencekey, "");
        familyreference.put("phone" + referencekey, "");
        familyreference.put("collaborate" + referencekey, "");
        familyreference.put("relations" + referencekey, "");

      }
      for (MapplicantFamily.Reference reference : simmapplicantwithgson.mapplicantFamily.reference) {
        familyreference.put("name" + roundreference, chk.chkNullString(reference.name," "));
        familyreference.put("jobtitle" + roundreference, chk.chkNullString(reference.jobtitle," "));
        familyreference.put("dept" + roundreference, chk.chkNullString(reference.dept," "));
        familyreference.put("companyname" + roundreference, chk.chkNullString(reference.companyname," "));
        familyreference.put("phone" + roundreference, chk.chkNullString(reference.phone," "));
        familyreference.put("collaborate" + roundreference, chk.chkNullString(reference.collaborate," "));
        familyreference.put("relations" + roundreference, chk.chkNullString(reference.relations," "));
        roundreference++;
      }
      //----------------------------END REFERENCE-----------------------------------------
      //----------------------------SETDATA REFERENCE ------------------------------------
      MyHashMap jobexp_training = new MyHashMap();
      int roundtraining = 0;

      for (int trainingkey = 0; trainingkey <= 5; trainingkey++){
        jobexp_training.put("certificate" + trainingkey, "");
        jobexp_training.put("name" + trainingkey, "");
        jobexp_training.put("by" + trainingkey, "");
        jobexp_training.put("start" + trainingkey, "");
        jobexp_training.put("end" + trainingkey, "");
      }
      for (MapplicantJobexp.Training training : simmapplicantwithgson.mapplicantJobexp.training) {
        jobexp_training.put("certificate" + roundtraining, chk.chkNullString(training.certificate," "));
        jobexp_training.put("name" + roundtraining, chk.chkNullString(training.name," "));
        jobexp_training.put("by" + roundtraining, chk.chkNullString(training.by," "));
        jobexp_training.put("start" + roundtraining, chk.chkNullString(new CscCalendar(training.start.toString().substring(0,10)).getDDMMYYYY().replaceAll("-","/")," "));
        jobexp_training.put("end" + roundtraining,chk.chkNullString(new CscCalendar(training.end.toString().substring(0,10)).getDDMMYYYY().replaceAll("-","/")," "));
        roundtraining++;
      }
    //----------------------------END REFERENCE-----------------------------------------

    //----------------------------End Jobrouter ----------------------------------------
    try {
      CscCalendar calendar = new CscCalendar();
      GregorianCalendar gc = new GregorianCalendar();
      boolean langthai = screen.getUProfile().get("lang").equalsIgnoreCase("THA");
      String reportname = "", printdate = "", printby = "", refer = "RTA2007";
      String reportname_label = "", printdate_label = "", prdate = "", refer_label = "";
      if (langthai) {
      reportname_label = "รายงาน :";
      reportname = "รายงานข้อมูลพนักงาน";
      printdate_label = "วันที่พิมพ์ :";
      prdate = calendar.getDDMMYYYY();
      printdate = "วัน" + calendar.getLongThiDOW() + "ที่ " + calendar.getDate() + " " + calendar.getThaiLongMonth() + " พ.ศ. " + calendar.getThaiYYYY() + " " + calendar.getHHMM() + " น.";
      printby = screen.getUProfile().get("tfullname");
      refer_label = "อ้างอิง #";
      } else {
      reportname_label = "Report Name :";
      reportname = "Personal Report";
      printdate_label = "Print Date :";
      printby = screen.getUProfile().get("efullname");
      refer_label = "Ref #";
    }

    // --------------- new line -----------------
      sizeColumn = new float[]{20.0f,60.0f,20.0f};
      PdfPTable detailHeader = new PdfPTable(3);
      detailHeader.setWidthPercentage(100);
      detailHeader.setWidths(sizeColumn);
      PdfPCell cellDetail;
      Image img = null;
      
      //Image logo= new Image(ImageDataFactory.create(IMG));
      setPaddingTop(1.0f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(4.5f);

      DbInquiry mcom = new InitialInquiry(screen.getUProfile()).getDbInquiry("mcompany");
      mcom.setColumn("logo");
      mcom.setFilter("companyid='100'");
      mcom.refresh();
      mcom.next();


 //     img = Image.getInstance(getImagePath("COMPANY_UPLOAD-dir","LOGO/",mcom.getString("logo"),"default.png"));
 //     cellDetail = new PdfPCell(img, true);
 //     cellDetail.setHorizontalAlignment(Element.ALIGN_CENTER);
 //     cellDetail.setVerticalAlignment (Element.ALIGN_MIDDLE);
 //     mcom.closeConnection();
  //    cellDetail.setColspan(2);
  //    cellDetail.setRowspan(3);
  //    cellDetail.setBorder(Rectangle.NO_BORDER);
  //    detail.addCell(cellDetail);
   
      //detail.addCell(getCellData("LOGO", font_C18B, "", "CENTER", "MIDDLE", 2, 3));
  //    setPaddingBottom(3.5f);
      try{
        img = Image.getInstance(getImagePath("RECRUIT_UPLOAD-dir","PICTURE/",simmapplicantwithgson.mapplicantPersonal.imgname,"DEFAULTPERSON.jpg"));
        img.scaleToFit(80, 100);
     //   cellDetail = new PdfPCell(img, true);
     //   cellDetail.setHorizontalAlignment(Element.ALIGN_CENTER);
     //   cellDetail.setVerticalAlignment (Element.ALIGN_MIDDLE);
     //   cellDetail.setFixedHeight(80);
     //   cellDetail.setBorder(Rectangle.NO_BORDER);
      img.setAbsolutePosition(470f, 750f);
     //   detailHeader.addCell(cellDetail);
      }
      catch (Exception e) {
        detailHeader.addCell(getCellData("NO PIC", font_C16B, "", "CENTER", "MIDDLE", 1, 5));
      } 
      document.add(img);
      // --------------- new line -----------------
      sizeColumn = new float[]{20.0f,50.0f,13.0f,15.0f};
      PdfPTable detail = new PdfPTable(4);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(7.5f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Name & Surname :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(FullnameEng, font_C10N, "R_BOTTOM", "CENTER", "MIDDLE", 1, 1));
      detail.addCell(getCellData("Nick Name :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(NickameEng, font_C10N, "R_BOTTOM", "CENTER", "MIDDLE", 1, 1));
      detail.addCell(getCellData("ชื่อ และ นามสกุล :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(FullnameThai, font_C10N, "R_BOTTOM", "CENTER", "MIDDLE", 1, 1));
      detail.addCell(getCellData("ชื่อเล่น :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(NickameThai, font_C10N, "R_BOTTOM", "CENTER", "MIDDLE", 1, 1));
      document.add(detail);
      // --------------- new line -----------------
      sizeColumn = new float[]{23.0f,40.0f,10.0f,10.0f,13.0f};
      detail = new PdfPTable(5);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(7.5f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Position Applied for : 1.", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(langthai? screen.getString("MJOBCODE", "TDESC"):screen.getString("MJOBCODE", "EDESC"), font_C10N, "R_BOTTOM", "CENTER", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Salary:", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      //!!! if Salary NO data
      if(screen.getString("MAPPLICANT","SALARY_EXPECT").length() == 0){
        detail.addCell(getCellData("  ", font_C10N, "R_BOTTOM", "CENTER", "MIDDLE", 1, 1));
      }
      else{
      String Salary_Expect = screen.getString("MAPPLICANT","SALARY_EXPECT").replaceAll(",","");
      detail.addCell(getCellData(DFO.format(Integer.valueOf(Salary_Expect)).toString(), font_C10N, "R_BOTTOM", "CENTER", "TOP", 1, 1,true,false));
      } 
      detail.addCell(getCellData("Baht / Month", font_C10B, "NO", "CENTER", "TOP", 1, 1));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("ตำแหน่งที่ต้องการ : ", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("เงินเดือน :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("บาท / เดือน", font_C10N, "NO", "LEFT", "MIDDLE", 1, 1));
      document.add(detail);
      // --------------- new line -----------------
      sizeColumn = new float[]{100.0f};
      detail = new PdfPTable(1);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(10.5f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Personal information (ประวัติส่วนตัว)", font_C12B, "NO", "LEFT", "MIDDLE", 1, 1));
      document.add(detail);
      // --------------- new line -----------------
      sizeColumn = new float[]{20.0f,25.0f,7.0f,25.0f,8.0f,20.0f};
      detail = new PdfPTable(6);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(7.5f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Present Address :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(simmapplicantwithgson.mapplicantContact.current.addr, font_C10N, "R_BOTTOM", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Moo:", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(simmapplicantwithgson.mapplicantContact.current.moo, font_C10N, "R_BOTTOM", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Road:", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(simmapplicantwithgson.mapplicantContact.current.road, font_C10N, "R_BOTTOM", "LEFT", "TOP", 1, 1,true,false));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("ที่อยู่ปัจจุบันเลขที่ :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("หมู่ที่ :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("ถนน :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      document.add(detail);
      // --------------- new line -----------------
      sizeColumn = new float[]{10.0f,40.0f,10.0f,40.0f};
      detail = new PdfPTable(4);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(7.5f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("District :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(simmapplicantwithgson.mapplicantContact.current.district, font_C10N, "R_BOTTOM", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Amphur :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(simmapplicantwithgson.mapplicantContact.current.zipcode.disname.tha, font_C10N, "R_BOTTOM", "LEFT", "TOP", 1, 1,true,false));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("ตำบล/แขวง :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("อำเภอ/เขต :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      document.add(detail);
      // --------------- new line -----------------
      sizeColumn = new float[]{11.0f,40.0f,12.0f,38.0f};
      detail = new PdfPTable(4);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(7.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Province :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(simmapplicantwithgson.mapplicantContact.current.zipcode.proname.tha, font_C10N, "R_BOTTOM", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Post Code :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(simmapplicantwithgson.mapplicantContact.current.zipcode.zipid, font_C10N, "R_BOTTOM", "LEFT", "TOP", 1, 1,true,false));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("จังหวัด :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("รหัสไปรษณีย์ :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      document.add(detail);
     
      // --------------- new line -----------------
      sizeColumn = new float[]{6.0f,40.0f,9.0f,40.0f};
      detail = new PdfPTable(4);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(7.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Tel :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(simmapplicantwithgson.mapplicantContact.current.number, font_C10N, "R_BOTTOM", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Mobile :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(simmapplicantwithgson.mapplicantContact.phone, font_C10N, "R_BOTTOM", "LEFT", "TOP", 1, 1,true,false));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("โทรศัพท์ :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("มือถือ :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      document.add(detail);
      // --------------- new line -----------------
      sizeColumn = new float[]{9.0f,91.0f};
      detail = new PdfPTable(2);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(7.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Email :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(screen.getString("MAPPLICANT","EMAIL"), font_C10N, "R_BOTTOM", "LEFT", "TOP", 1, 1,true,false));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("อีเมลล์ :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      document.add(detail);
      // --------------- new line -----------------

      String addr = " "+simmapplicantwithgson.mapplicantContact.home.addr;
      String moo = " หมู่  "+simmapplicantwithgson.mapplicantContact.home.moo;
      String soi = " ซ."+simmapplicantwithgson.mapplicantContact.home.soi;
      String road = " ถนน "+simmapplicantwithgson.mapplicantContact.home.road;
      String district = " "+simmapplicantwithgson.mapplicantContact.home.district;
      String disname = " "+simmapplicantwithgson.mapplicantContact.home.zipcode.disname.tha;
      String proname = " "+simmapplicantwithgson.mapplicantContact.home.zipcode.proname.tha;
      String zipid = " "+simmapplicantwithgson.mapplicantContact.home.zipcode.zipid;
      String  homeAddr = addr+moo+soi+road+district+disname+zipid;
      sizeColumn = new float[]{18.0f,82.0f};
      detail = new PdfPTable(2);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(7.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Official Address :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(homeAddr, font_C10N, "R_BOTTOM", "LEFT", "TOP", 1, 1,true,false));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("ที่อยู่ตามทะเบียนบ้าน :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      document.add(detail);
      // --------------- new line ----------------
      String residenceid = simmapplicantwithgson.mapplicantPersonal.residenceid;
      sizeColumn = new float[]{20.0f,10.0f,12.0f,10.0f,10.0f,10.0f,20.0f,10.0f};
      detail = new PdfPTable(8);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(10.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Living with Parent", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(residenceid.equals("1")? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Own Home", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(residenceid.equals("2")? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Rented", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(residenceid.equals("3")? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Hired Flat / Hostel", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(residenceid.equals("4")? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "LEFT", "TOP", 1, 1,true,false));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("อาศัยกับครอบครัว", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("บ้านตัวเอง ", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("บ้านเช่า", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("หอพัก", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      document.add(detail);
      // --------------- new line ----------------
      sizeColumn = new float[]{14.0f,15.0f,8.0f,8.0f,15.0f,10.0f,10.0f,8.0f,18.0f};
      detail = new PdfPTable(9);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(10.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Date of Birth", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(langthai? new CscCalendar(simmapplicantwithgson.mapplicantPersonal.birthdate.substring(0, 10)).getThaiDDMMYYYY().replaceAll("-","/")
      : new CscCalendar(simmapplicantwithgson.mapplicantPersonal.birthdate.substring(0, 10)).getDDMMYYYY().replaceAll("-","/"), font_C10N, "R_BOTTOM", "CENTER", "TOP", 1, 1,true,false));
      detail.addCell(getCellData(" ", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData("Age :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(age_memployee.substring(0,2), font_C10N, "R_BOTTOM", "CENTER", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Yrs. Old", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" ", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData("Race :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(nationalityDesc, font_C10N, "R_BOTTOM", "LEFT", "TOP", 1, 1,true,false));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("วัน เดือน ปีเกิด :", font_C10N, "NO", "LEFT", "MIDDLE", 3, 1));
      detail.addCell(getCellData("อายุ :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("ปี :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("เชื้อชาติ :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      document.add(detail);
      // --------------- new line -----------------
      sizeColumn = new float[]{13.0f,35.0f,7.0f,12.0f,38.0f};
      detail = new PdfPTable(5);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(7.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Nationality :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(nationaldesc, font_C10N, "R_BOTTOM", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("  ", font_C10N, "NO", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Religion :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(religionDesc, font_C10N, "R_BOTTOM", "LEFT", "TOP", 1, 1,true,false));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("สัญชาติ:", font_C10N, "NO", "LEFT", "MIDDLE", 3, 1));
      detail.addCell(getCellData("ศาสนา :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      document.add(detail);
      // --------------- new line -----------------
      sizeColumn = new float[]{21.0f,27.0f,7.0f,18.0f,32.0f};
      detail = new PdfPTable(5);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(0.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Identity Card No. :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(simmapplicantwithgson.mapplicantPersonal.identification.iden_number, font_C10N, "R_BOTTOM", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("  ", font_C10N, "NO", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Expiration Date :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(new CscCalendar(simmapplicantwithgson.mapplicantPersonal.identification.pinend.substring(0, 10)).getThaiDDMMYYYY().replaceAll("-","/"), font_C10N, "R_BOTTOM", "LEFT", "TOP", 1, 1,true,false));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("บัตรประชาชนเลขที่:", font_C10N, "NO", "LEFT", "MIDDLE", 3, 1));
      detail.addCell(getCellData("บัตรหมดอายุ :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      document.add(detail);
      // --------------- new line -----------------
      sizeColumn = new float[]{10.0f,38.0f,7.0f,10.0f,30.0f,10.0f};
      detail = new PdfPTable(6);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(7.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Height :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(simmapplicantwithgson.mapplicantPersonal.height, font_C10N, "R_BOTTOM", "CENTER", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("cm.", font_C10B, "NO", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Weight :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(simmapplicantwithgson.mapplicantPersonal.weight, font_C10N, "R_BOTTOM", "CENTER", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("kg.", font_C10B, "NO", "LEFT", "TOP", 1, 1,true,false));

      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("ส่วนสูง:", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("ซม.", font_C10N, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData("น้ำหนัก:", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("กก.", font_C10N, "NO", "LEFT", "MIDDLE", 1, 1));
      document.add(detail);
      // --------------- new line -----------------
      int genderid= simmapplicantwithgson.mapplicantPersonal.genderid;
      sizeColumn = new float[]{18.0f,10.0f,20.0f,10.0f,58.0f};
      detail = new PdfPTable(5);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(7.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Sex :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(genderid==1? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "RIGHT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Male", font_C10B, "NO", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData(genderid==2? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "RIGHT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Female", font_C10B, "NO", "LEFT", "TOP", 1, 1,true,false));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("เพศ :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("ชาย", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("หญิง", font_C10N, "NO", "LEFT", "MIDDLE", 1, 1));
      document.add(detail);
      // --------------- new line -----------------
      String military_status = simmapplicantwithgson.mapplicantPersonal.military.status;
      sizeColumn = new float[]{18.0f,10.0f,20.0f,10.0f,20.0f,10.0f,28.0f};
      detail = new PdfPTable(7);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(7.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Military status :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(military_status.equalsIgnoreCase("3")? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "RIGHT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Exempted", font_C10B, "NO", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData(military_status.equalsIgnoreCase("1")? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "RIGHT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Reserved", font_C10B, "NO", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData(military_status.equalsIgnoreCase("2")? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "RIGHT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Will be recruited", font_C10B, "NO", "LEFT", "TOP", 1, 1,true,false));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("ภาวะทางทหาร :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("ได้รับการยกเว้น", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("ปลดเป็นทหารกองหนุน", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("ยังไม่ได้บการเกณฑ์", font_C10N, "NO", "LEFT", "MIDDLE", 1, 1));
      document.add(detail);
      // --------------- new line -----------------
      String personal_status1 = simmapplicantwithgson.mapplicantPersonal.status;      
      sizeColumn = new float[]{18.0f,10.0f,10.0f,10.0f,10.0f,10.0f,10.0f,10.0f,10.0f,10.0f,10.0f};
      detail = new PdfPTable(11);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(7.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Marital status :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(personal_status1.equalsIgnoreCase("S")? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "RIGHT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Single", font_C10B, "NO", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData(personal_status1.equalsIgnoreCase("M")? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "RIGHT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Married", font_C10B, "NO", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData(personal_status1.equalsIgnoreCase("D")? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "RIGHT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Divorced", font_C10B, "NO", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData(personal_status1.equalsIgnoreCase("W")? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "RIGHT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Widowed", font_C10B, "NO", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData(personal_status1.equalsIgnoreCase("E")? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "RIGHT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Separated", font_C10B, "NO", "LEFT", "TOP", 1, 1,true,false));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("สถานภาพ :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("โสด", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("แต่งงาน", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("อย่า", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("หม้าย", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("แยกกัน", font_C10N, "NO", "LEFT", "MIDDLE", 1, 1));
      document.add(detail);
      // --------------- new line ----------------- 
      sizeColumn = new float[]{25.0f,35.0f,17.0f,23.0f};
      detail = new PdfPTable(4);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(7.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Name of wife/ Husband :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybackground.get("fname03").toString() + "  " + familybackground.get("lname03").toString(), font_C10N, "R_BOTTOM", "CENTER", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Working Place :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybackground.get("workplace03").toString(), font_C10N, "R_BOTTOM", "CENTER", "TOP", 1, 1,true,false));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("ชื่อภรรยา/สามี :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("สถานที่ทำงาน :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      document.add(detail);
      // --------------- new line ----------------- 
      sizeColumn = new float[]{12.0f,50.0f,23.0f,12.0f,10.0f};
      detail = new PdfPTable(5);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(7.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Position :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybackground.get("occupation03").toString(), font_C10N, "R_BOTTOM", "CENTER", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Number of Children :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData((Integer.valueOf(ChildAll)).toString(), font_C10N, "R_BOTTOM", "CENTER", "TOP", 1, 1,true,false));
      detail.addCell(getCellData("Person", font_C10B, "NO", "LEFT", "TOP", 1, 1,true,false));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("ตำแหน่ง :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("มีบุตร :", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("คน", font_C10N, "NO", "LEFT", "MIDDLE", 1, 1));
      document.add(detail);

      // --------------- new line ----------------- 
      PdfPCell CellFooter;
      Image imgFooter = null;
      imgFooter = Image.getInstance(getImagePath("COMPANY_UPLOAD-dir","LOGO/","LOGO.png","default.png"));
      imgFooter.scaleToFit(70f, 70f);
      imgFooter.setAbsolutePosition(510f,10f);
      CellFooter = new PdfPCell(imgFooter, true);

      //SET TEXT Header
      int pagenumber = 0;
      Phrase Header1 = new Phrase("APPLICATION FOR EMPLOYMENT - ใบสมัครงาน", font_C12B);
      Phrase Header2 = new Phrase("To be completed by own handwriting in English", font_C10N);
      Phrase Header3 = new Phrase("(กรอกข้อมูลด้วยตัวท่านเองเป็นภาษาอังกฤษ)", font_C10N);


      //SET TEXT FOOTER
      Phrase Footer1 = new Phrase("Kokotel (Thailand) Co.,Ltd.", font_C08B);
      Phrase Footer2 = new Phrase("140/22, 12th Floor, ITF Tower, Silom Road, Suriyawong, Bangrak, Bangkok 10500", font_C08N);
      Phrase Footer3 = new Phrase("Tel: +66 2 026 3219 Email: sirinya@kokote.com www.kokotel.com", font_C08N);
      PdfContentByte canvas = writer.getDirectContent();


      // PAGE1
      pagenumber++;
      ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, new Phrase(String.valueOf(pagenumber), font_C08B), 300, 810, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, Header1, 300, 790, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, Header2, 300, 775, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, Header3, 300, 762, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_RIGHT, Footer1, 500, 40, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_RIGHT, Footer2, 500, 30, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_RIGHT, Footer3, 500, 20, 0);
      document.add(imgFooter);



      // PAGE 2
      document.newPage();
      pagenumber++;
      ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, new Phrase(String.valueOf(pagenumber), font_C08B), 300, 810, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, Header1, 300, 790, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, Header2, 300, 775, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, Header3, 300, 762, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_RIGHT, Footer1, 500, 40, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_RIGHT, Footer2, 500, 30, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_RIGHT, Footer3, 500, 20, 0);
      document.add(imgFooter);

      // --------------- new line -----------------

      sizeColumn = new float[]{100.0f};
      detail = new PdfPTable(1);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(10.0f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(4.5f);
      content = new Phrase();
      content.add(new Chunk("Family & Relatives: ",font_C12B));
      content.add(new Chunk("(Parent, Brothers/ Sisters, Children) ",font_C10B));
      detail.addCell(getCellData2( content, "NO", "LEFT", "TOP",  1,  1) );
      setPaddingTop(0.5f);
      setPaddingBottom(10.5f);
      detail.addCell(getCellData("บุคคลในครอบครัว (บิดา/มารดา, พี่/น้อง, บุตร)", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      document.add(detail);
      // --------------- new line ----------------- 
      sizeColumn = new float[]{30.0f,20.0f,10.0f,20.0f,20.0f};
      detail = new PdfPTable(5);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(0.5f);
      setPaddingBottom(3.5f);
      content = new Phrase();
      content.add(new Chunk("Name\n",font_C10B));
      content.add(new Chunk("ชื่อ",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("Relationship\n",font_C10B));
      content.add(new Chunk("ความสัมพันธ์",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("Age\n",font_C10B));
      content.add(new Chunk("อายุ",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("Education\n",font_C10B));
      content.add(new Chunk("การศึกษา",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("Occupation\n",font_C10B));
      content.add(new Chunk("อาชีพ",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  1) );
      setPaddingTop(3.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData(familybg.get("fname1").toString() + "  " + familybg.get("lname1").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("relation1").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("age1").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("degreeid1").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("occupation1").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
     
      detail.addCell(getCellData(familybg.get("fname2").toString() + "  " + familybg.get("lname2").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("relation2").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("age2").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("degreeid2").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("occupation2").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));

      detail.addCell(getCellData(familybg.get("fname3").toString() + "  " + familybg.get("lname3").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("relation3").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("age3").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("degreeid3").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("occupation3").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));

      detail.addCell(getCellData(familybg.get("fname4").toString() + "  " + familybg.get("lname4").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("relation4").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("age4").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("degreeid4").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("occupation4").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));

      detail.addCell(getCellData(familybg.get("fname5").toString() + "  " + familybg.get("lname5").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("relation5").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("age5").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("degreeid5").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("occupation5").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));

      detail.addCell(getCellData(familybg.get("fname6").toString() + "  " + familybg.get("lname6").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("relation6").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("age6").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("degreeid6").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familybg.get("occupation6").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));

      document.add(detail);
      // --------------- new line -----------------
      sizeColumn = new float[]{100.0f};
      detail = new PdfPTable(1);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(10.0f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(4.5f);
      content = new Phrase();
      content.add(new Chunk("Education",font_C12N));
      content.add(new Chunk("(การศึกษา)",font_C10N));
      detail.addCell(getCellData2( content, "NO", "LEFT", "TOP",  1,  1) );
      document.add(detail);
      // --------------- new line ----------------- 
      sizeColumn = new float[]{22.0f,30.0f,30.0f,10.0f,10.0f};
      detail = new PdfPTable(5);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(3.5f);
      setPaddingBottom(3.5f);
      content = new Phrase();
      content.add(new Chunk("Educational Level\n",font_C10B));
      content.add(new Chunk("ระดับการศึกษา",font_C10N));
      detail.addCell(getCellData2( content, "", "LEFT", "TOP",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("Institution\n",font_C10B));
      content.add(new Chunk("สถาบันการศึกษา",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("Major\n",font_C10B));
      content.add(new Chunk("สาขาวิชา",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("From\n",font_C10B));
      content.add(new Chunk("ตั้งแต่",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("To\n",font_C10B));
      content.add(new Chunk("ถึง",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  1) );
      setPaddingTop(3.5f);
      setPaddingBottom(3.5f);
      
      content = new Phrase();
      content.add(new Chunk("Secondary school \n",font_C10B));
      content.add(new Chunk("(มัธยมศึกษาตอนต้น)",font_C10N));
      detail.addCell(getCellData2( content, "", "LEFT", "TOP",  1,  1) );
      detail.addCell(getCellData(educationbackground.get("name9").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("major9").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("from9").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("to9").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));

      content = new Phrase();
      content.add(new Chunk("High school \n",font_C10B));
      content.add(new Chunk("(มัธยมศึกษาตอนปลาย)",font_C10N));
      detail.addCell(getCellData2( content, "", "LEFT", "TOP",  1,  1) );
      detail.addCell(getCellData(educationbackground.get("name8").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("major8").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("from8").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("to8").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
    
      content = new Phrase();
      content.add(new Chunk("Vocational\n",font_C10B));
      content.add(new Chunk("(ปวช.)",font_C10N));
      detail.addCell(getCellData2( content, "", "LEFT", "TOP",  1,  1) );
      detail.addCell(getCellData(educationbackground.get("name7").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("major7").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("from7").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("to7").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));

      content = new Phrase();
      content.add(new Chunk("Technical\n",font_C10B));
      content.add(new Chunk("(ปวส.)",font_C10N));
      detail.addCell(getCellData2( content, "", "LEFT", "TOP",  1,  1) );
      detail.addCell(getCellData(educationbackground.get("name5").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("major5").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("from5").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("to5").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));

      content = new Phrase();
      content.add(new Chunk("Bachelor degree\n",font_C10B));
      content.add(new Chunk("(ปริญญาตรี)",font_C10N));
      detail.addCell(getCellData2( content, "", "LEFT", "TOP",  1,  1) );
      detail.addCell(getCellData(educationbackground.get("name3").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("major3").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("from3").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("to3").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));

      content = new Phrase();
      content.add(new Chunk("Master degree\n",font_C10B));
      content.add(new Chunk("(ปริญญาโท)",font_C10N));
      detail.addCell(getCellData2( content, "", "LEFT", "TOP",  1,  1) );
      detail.addCell(getCellData(educationbackground.get("name2").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("major2").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("from2").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("to2").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));

      content = new Phrase();
      content.add(new Chunk("Doctor of Philosophy \n",font_C10B));
      content.add(new Chunk("(ปริญญาเอก)",font_C10N));
      detail.addCell(getCellData2( content, "", "LEFT", "TOP",  1,  1) );
      detail.addCell(getCellData(educationbackground.get("name1").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("major1").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("from1").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("to1").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));

      content = new Phrase();
      content.add(new Chunk("Others\n",font_C10B));
      content.add(new Chunk("(อื่นๆ)",font_C10N));
      detail.addCell(getCellData2( content, "", "LEFT", "TOP",  1,  1) );
      detail.addCell(getCellData(educationbackground.get("name4").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("major4").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("from4").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(educationbackground.get("to4").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      document.add(detail);

      // --------------- new line ----------------- 
      boolean chkactivity = true;
      if(hmactivity.get("name0").toString().equalsIgnoreCase("") || hmactivity.get("name0").toString().equalsIgnoreCase(null)){
        chkactivity = false;
      }
      sizeColumn = new float[]{80.0f,5.0f,5.0f,5.0f,5.0f};
      detail = new PdfPTable(5);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(20.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Did you participate in any special activities while you were studying? ", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData("Yes", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(chkactivity? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData("No", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(!chkactivity? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "LEFT", "MIDDLE", 1, 1));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("ท่านเคยร่วมกิจกรรมพิเศษระหว่างที่ศึกษาอยู่หรือไม่? ", font_C10N, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData("เคย", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("ไม่เคย", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));    
      document.add(detail);

      // --------------- new line ----------------- 
      sizeColumn = new float[]{20.0f,80.0f};
      detail = new PdfPTable(2);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(20.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("If Yes, what activity", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(hmactivity.get("name0").toString(), font_C10N, "R_BOTTOM", "LEFT", "MIDDLE", 1, 1));      
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("ถ้าเคย โปรดระบุกิจกรรม", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      document.add(detail);

      // --------------- new line ----------------- 
      Boolean health = simmapplicantwithgson.mapplicantOther.health.status;
      String health_ex = simmapplicantwithgson.mapplicantOther.health.explain;
      sizeColumn = new float[]{80.0f,5.0f,5.0f,5.0f,5.0f};
      detail = new PdfPTable(5);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(20.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Have you ever been seriously illness or contracted with contagious disease? ", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData("Yes", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(health? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData("No", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(!health? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "LEFT", "MIDDLE", 1, 1));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("ท่านเคยป่วยหนักและเป็นโรคติดต่อร้ายแรงมาก่อนหรือไม่? ", font_C10N, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData("เคย", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("ไม่เคย", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));    
      document.add(detail);
      // --------------- new line ----------------- 
      sizeColumn = new float[]{28.0f,72.0f};
      detail = new PdfPTable(2);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(20.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("If yes, (Please explain fully) :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(health?health_ex:" ", font_C10N, "R_BOTTOM", "LEFT", "MIDDLE", 1, 1));      
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("ถ้าเคย ระบุชื่อโรค", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      document.add(detail);


      // PAGE 3
      document.newPage();
      pagenumber++;
      ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, new Phrase(String.valueOf(pagenumber), font_C08B), 300, 810, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, Header1, 300, 790, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, Header2, 300, 775, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, Header3, 300, 762, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_RIGHT, Footer1, 500, 40, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_RIGHT, Footer2, 500, 30, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_RIGHT, Footer3, 500, 20, 0);
      document.add(imgFooter);

      // --------------- new line -----------------
      sizeColumn = new float[]{100.0f};
      detail = new PdfPTable(1);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(10.0f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(4.5f);
      content = new Phrase();
      content.add(new Chunk("Employment in Chronological ",font_C12N));
      content.add(new Chunk("(ประวัติการทำงาน เรียงลำดับจากปัจจุบันลงมา) ",font_C10N));
      detail.addCell(getCellData2( content, "NO", "LEFT", "TOP",  1,  1) );
      setPaddingTop(0.5f);
      setPaddingBottom(10.5f);
      document.add(detail);
      // --------------- new line ----------------- 
      sizeColumn = new float[]{20.0f,13.0f,13.0f,20.0f,20.0f,10.0f,20.0f};
      detail = new PdfPTable(7);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(3.5f);
      setPaddingBottom(3.5f);
      content = new Phrase();
      content.add(new Chunk("Company\n",font_C10B));
      content.add(new Chunk("(สถานที่ทำงาน)",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  2) );
      content = new Phrase();
      content.add(new Chunk("Time\n",font_C10B));
      content.add(new Chunk("ระยะเวลา",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  2,  1) );
      content = new Phrase();
      content.add(new Chunk("Position\n",font_C10B));
      content.add(new Chunk("ตำแหน่งงาน",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  2) );
      content = new Phrase();
      content.add(new Chunk("Job Description\n",font_C10B));
      content.add(new Chunk("ลักษณะงาน",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  2) );
      content = new Phrase();
      content.add(new Chunk("Salary\n",font_C10B));
      content.add(new Chunk("ค่าจ้าง",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  2) );
      content = new Phrase();
      content.add(new Chunk("Reasons of Leaving\n",font_C10B));
      content.add(new Chunk("เหตุผลที่ออก",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  2) );
      content = new Phrase();
      content.add(new Chunk("From\n",font_C10B));
      content.add(new Chunk("เริ่ม",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("TO\n",font_C10B));
      content.add(new Chunk("ถึง",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  1) );

      setPaddingTop(3.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData(" "+jobexp.get("companyname_job0").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("start0").toString(), font_C08N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(jobexp.get("present0") == null?" ":" "+jobexp.get("end0").toString(), font_C08N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("title0").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("description0").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("salary0").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("reason0").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
   
      detail.addCell(getCellData(" "+jobexp.get("companyname_job1").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("start1").toString(), font_C08N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("end1").toString(), font_C08N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("title1").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("description1").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("salary1").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("reason1").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));

      detail.addCell(getCellData(" "+jobexp.get("companyname_job2").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("start2").toString(), font_C08N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("end2").toString(), font_C08N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("title2").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("description2").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("salary2").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("reason2").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));

      detail.addCell(getCellData(" "+jobexp.get("companyname_job3").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("start3").toString(), font_C08N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("end3").toString(), font_C08N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("title3").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("description3").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("salary3").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("reason3").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));

      detail.addCell(getCellData(" "+jobexp.get("companyname_job4").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("start4").toString(), font_C08N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("end4").toString(), font_C08N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("title4").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("description4").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("salary4").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" "+jobexp.get("reason4").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));

      document.add(detail);
      // --------------- new line ----------------- 
      boolean  askoldcompany = simmapplicantwithgson.mapplicantOther.askoldcompany;
      String askoldcompanyDesc = simmapplicantwithgson.mapplicantOther.askoldcompanyDesc;
      sizeColumn = new float[]{80.0f,5.0f,5.0f,5.0f,5.0f};
      detail = new PdfPTable(5);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(20.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Would you allow any reference check with your former employer(s)?", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData("Yes", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(askoldcompany? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData("No", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(!askoldcompany? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "LEFT", "MIDDLE", 1, 1));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("โรงแรมจะสอบประวัติท่านจากนายจ้างเดิมได้หรือไม่ ? ", font_C10N, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData("ได้", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("ไม่ได้", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));    
      document.add(detail);
      // --------------- new line ----------------- 
      sizeColumn = new float[]{20.0f,80.0f};
      detail = new PdfPTable(2);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(20.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("If No, Please explain", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(askoldcompany?" ":askoldcompanyDesc, font_C10N, "R_BOTTOM", "LEFT", "MIDDLE", 1, 1));      
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("ถ้าไม่ได้ โปรดระบุเหตุผล", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      document.add(detail);

      // --------------- new line -----------------
      sizeColumn = new float[]{100.0f};
      detail = new PdfPTable(1);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(20.0f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(4.5f);
      detail.addCell(getCellData("Reference persons from work, (ex. Supervisor / Manager / Director / HR)", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      setPaddingTop(0.5f);
      setPaddingBottom(20.5f);
      detail.addCell(getCellData("บุคคลอ้างอิงจากที่ท่านเก่า ตำแหน่ง และเบอร์ติดต่อ(หัวหน้างาน, ผู้จัดการ, ผู้อำนวยการ, ฝ่ายบุคคล)", font_C10N, "NO", "LEFT", "MIDDLE", 1, 1));
      document.add(detail);

      // --------------- new line ----------------- 

      sizeColumn = new float[]{20.0f,13.0f,13.0f,20.0f,20.0f,20.0f};
      detail = new PdfPTable(6);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(3.5f);
      setPaddingBottom(3.5f);
      content = new Phrase();
      content.add(new Chunk("Name-Surname\n",font_C10B));
      content.add(new Chunk("ชื่อ นามสกุล",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "MIDDLE",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("Position\n",font_C10B));
      content.add(new Chunk("ต่ำแหน่ง",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "MIDDLE",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("Department\n",font_C10B));
      content.add(new Chunk("แผนก",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "MIDDLE",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("Company\n",font_C10B));
      content.add(new Chunk("บริษัท",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "MIDDLE",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("Phone contact\n",font_C10B));
      content.add(new Chunk("เบอร์ติดต่อ",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "MIDDLE",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("Period for working together\n",font_C10B));
      content.add(new Chunk("ระยะเวลาในการร่วมงาน (ex. 2 ปี)",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "MIDDLE",  1,  1) );
      setPaddingTop(3.5f);
      detail.addCell(getCellData(familyreference.get("name0").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familyreference.get("jobtitle0").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familyreference.get("dept0").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familyreference.get("companyname0").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familyreference.get("phone0").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familyreference.get("collaborate0").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));

      detail.addCell(getCellData(familyreference.get("name1").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familyreference.get("jobtitle1").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familyreference.get("dept1").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familyreference.get("companyname1").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familyreference.get("phone1").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(familyreference.get("collaborate1").toString(), font_C10N, "", "LEFT", "MIDDLE", 1, 1));

      document.add(detail);
      // --------------- new line ----------------- 
      String referfullname = comreference.get("name0").toString()+" "+comreference.get("lname0").toString();
      sizeColumn = new float[]{60.0f,40.0f};
      detail = new PdfPTable(2);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(20.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Do you know anyone who work with Kokotel Thailand? Please specific name (if yes)", font_C10B, "NO", "LEFT", "MIDDLE", 2, 1));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("ท่านมีเพื่อนที่ทำงานโคโคเทล หรือมีคนรู้จักหรือไม่ หากมี โปรดระบุชื่อ", font_C10N, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(referfullname, font_C10N, "R_BOTTOM", "LEFT", "MIDDLE", 1, 1));
      document.add(detail);

      // PAGE 4
      document.newPage();
      pagenumber++;
      ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, new Phrase(String.valueOf(pagenumber), font_C08B), 300, 810, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, Header1, 300, 790, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, Header2, 300, 775, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, Header3, 300, 762, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_RIGHT, Footer1, 500, 40, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_RIGHT, Footer2, 500, 30, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_RIGHT, Footer3, 500, 20, 0);
      document.add(imgFooter);

      // --------------- new line -----------------
      sizeColumn = new float[]{100.0f};
      detail = new PdfPTable(1);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(10.0f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(4.5f);
      content = new Phrase();
      content.add(new Chunk("Language Ability ",font_C12B));
      content.add(new Chunk("(ภาษา) ",font_C10B));
      detail.addCell(getCellData2( content, "NO", "LEFT", "TOP",  1,  1) );
      setPaddingTop(0.5f);
      setPaddingBottom(10.5f);
      document.add(detail);
      // --------------- new line -----------------
      sizeColumn = new float[]{22.0f,9.0f,9.0f,9.0f,9.0f,9.0f,9.0f,9.0f,9.0f,9.0f};
      detail = new PdfPTable(10);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(10.0f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(4.5f);
      content = new Phrase();
      content.add(new Chunk("Language\n",font_C10B));
      content.add(new Chunk("ภาษา ",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  2) );
      content = new Phrase();
      content.add(new Chunk("Speaking",font_C10B));
      content.add(new Chunk("(พูด) ",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  3,  1) );
      content = new Phrase();
      content.add(new Chunk("Writing",font_C10B));
      content.add(new Chunk("(เขียน) ",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  3,  1) );
      content = new Phrase();
      content.add(new Chunk("Reading",font_C10B));
      content.add(new Chunk("(อ่าน) ",font_C10N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  3,  1) );
      
      content = new Phrase();
      content.add(new Chunk("Good\n",font_C10B));
      content.add(new Chunk("ดี",font_C08N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("Fair\n",font_C10B));
      content.add(new Chunk("ปานกลาง",font_C08N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("Poor\n",font_C10B));
      content.add(new Chunk("พอใช้ ",font_C08N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("Good\n",font_C10B));
      content.add(new Chunk("ดี",font_C08N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("Fair\n",font_C10B));
      content.add(new Chunk("ปานกลาง",font_C08N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("Poor\n",font_C10B));
      content.add(new Chunk("พอใช้ ",font_C08N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("Good\n",font_C10B));
      content.add(new Chunk("ดี",font_C08N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("Fair\n",font_C10B));
      content.add(new Chunk("ปานกลาง",font_C08N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("Poor\n",font_C10B));
      content.add(new Chunk("พอใช้ ",font_C08N));
      detail.addCell(getCellData2( content, "", "CENTER", "TOP",  1,  1) );

      detail.addCell(getCellData(hmlangskill.get("skillNameTdesc0").toString() +" ", font_C10N, "", "LEFT", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("speak0").toString().equalsIgnoreCase("3")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("speak0").toString().equalsIgnoreCase("2")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("speak0").toString().equalsIgnoreCase("1")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("reading0").toString().equalsIgnoreCase("3")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("reading0").toString().equalsIgnoreCase("2")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("reading0").toString().equalsIgnoreCase("1")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("write0").toString().equalsIgnoreCase("3")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("write0").toString().equalsIgnoreCase("2")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("write0").toString().equalsIgnoreCase("1")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("skillNameTdesc1").toString() +" ", font_C10N, "", "LEFT", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("speak1").toString().equalsIgnoreCase("3")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("speak1").toString().equalsIgnoreCase("2")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("speak1").toString().equalsIgnoreCase("1")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("reading1").toString().equalsIgnoreCase("3")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("reading1").toString().equalsIgnoreCase("2")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("reading1").toString().equalsIgnoreCase("1")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("write1").toString().equalsIgnoreCase("3")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("write1").toString().equalsIgnoreCase("2")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("write1").toString().equalsIgnoreCase("1")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("skillNameTdesc2").toString() +" ", font_C10N, "", "LEFT", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("speak2").toString().equalsIgnoreCase("3")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("speak2").toString().equalsIgnoreCase("2")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("speak2").toString().equalsIgnoreCase("1")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("reading2").toString().equalsIgnoreCase("3")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("reading2").toString().equalsIgnoreCase("2")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("reading2").toString().equalsIgnoreCase("1")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("write2").toString().equalsIgnoreCase("3")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("write2").toString().equalsIgnoreCase("2")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      detail.addCell(getCellData(hmlangskill.get("write2").toString().equalsIgnoreCase("1")? AwesomeIcons.ICON_OK:" ", fontAwesome, " ", "CENTER", "BOTTOM", 1, 1));
      document.add(detail);

      // --------------- new line -----------------
      sizeColumn = new float[]{100.0f};
      detail = new PdfPTable(1);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(10.0f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(10.5f);
      content = new Phrase();
      content.add(new Chunk("Special Ability ",font_C10B));
      content.add(new Chunk("(ความสามารถพิเศษ) ",font_C10N));
      detail.addCell(getCellData2( content, "NO", "LEFT", "TOP",  1,  1) );

      document.add(detail);
      // --------------- new line ---------------- 
      Boolean type_chk = simmapplicantwithgson.mapplicantSkill.typing.active;
      String type_thai = type_chk?chk.chkNullString(simmapplicantwithgson.mapplicantSkill.typing.tha,"-"):"-";
      String type_eng = type_chk?chk.chkNullString(simmapplicantwithgson.mapplicantSkill.typing.eng,"-"):"-";
      String typetext = " คำ/นาที";
     

      Boolean softwarePackage = simmapplicantwithgson.mapplicantSkill.computerSkills.softwarePackage;
      String softwarePackagedesc = simmapplicantwithgson.mapplicantSkill.computerSkills.softwarePackagedesc;
      sizeColumn = new float[]{10.0f,3.0f,3.0f,3.0f,6.0f,3.0f,8.0f,5.0f,12.0f};
      detail = new PdfPTable(9);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(4.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("typeing:", font_C10N, "R_TL", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData("NO", font_C10N, "R_TOP", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(!type_chk?AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "R_TOP", "LEFT","MIDDLE", 1, 1));
      detail.addCell(getCellData("Yes", font_C10N, "R_TOP", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(type_chk?AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "R_TOP", "LEFT","MIDDLE", 1, 1));
      detail.addCell(getCellData("Thai", font_C10N, "R_TOP", "LEFT", "MIDDLE", 1, 1));
      Chunk type_thai2 = new Chunk(type_thai.equals("-")? "-":type_thai + typetext,font_C10N);
      type_thai2.setUnderline(0.1f, -2f);
      content = new Phrase();
      content.add(type_thai2);
      detail.addCell(getCellData2( content, "R_TOP", "LEFT", "MIDDLE",  1,  1));
      detail.addCell(getCellData("English", font_C10N, "R_TOP", "LEFT", "MIDDLE", 1, 1));
      Chunk type_eng2 = new Chunk(type_eng.equals("-")? "-":type_eng + typetext,font_C10N);
      type_eng2.setUnderline(0.1f, -2f);
      content = new Phrase();
      content.add(type_eng2);
      detail.addCell(getCellData2( content, "R_TR", "LEFT", "MIDDLE",  1,  1));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("พิมพ์ดีด", font_C10N, "R_LEFT", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData("ไม่ได้", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("ได้", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("ไทย", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("อังกฤษ", font_C10N, "R_RIGHT", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData(" ", font_C10N, "R_LRB", "LEFT", "MIDDLE", 9, 1));

      detail.addCell(getCellData("Computer:", font_C10N, "R_LEFT", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData("NO", font_C10N, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(false? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData("Yes (Please Specific)", font_C10N, "R_RIGHT", "LEFT", "MIDDLE", 6, 1));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("คอมพิวเตอร์", font_C10N, "R_LEFT", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData("ไม่ได้", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("ได้ โปรดระบุ", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      Chunk comSkills = new Chunk(softwarePackagedesc,font_C10N);
      comSkills.setUnderline(0.1f, -2f);
      content = new Phrase();
      content.add(comSkills);
      detail.addCell(getCellData2( content, "R_RIGHT", "LEFT", "MIDDLE",  4,  1) );
      detail.addCell(getCellData(" ", font_C10N, "R_LRB", "LEFT", "MIDDLE", 9, 1));

      document.add(detail);
      // --------------- new line -----------------
      sizeColumn = new float[]{100.0f};
      detail = new PdfPTable(1);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(4.0f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(4.5f);
      detail.addCell(getCellData("Hobbies (Please Specific): งานอดิเรก โปรดระบุ", font_C10N, "R_LR", "LEFT", "MIDDLE", 1, 1));
      Chunk hobbieList2 = new Chunk(hobbieList,font_C10N);
      hobbieList2.setUnderline(0.1f, -2f);
      content = new Phrase();
      content.add(hobbieList2);
      detail.addCell(getCellData2( content, "R_LRB", "LEFT", "MIDDLE",  1,  1));

      detail.addCell(getCellData("Favorite Sport (Please Specific): กีฬาที่ชอบ โปรดระบุ", font_C10N, "R_LR", "LEFT", "MIDDLE", 1, 1));
      Chunk sportList2 = new Chunk(sportList,font_C10N);
      sportList2.setUnderline(0.1f, -2f);
      content = new Phrase();
      content.add(sportList2);
      detail.addCell(getCellData2( content, "R_LRB", "LEFT", "MIDDLE",  1,  1));
      document.add(detail);
      // --------------- new line -----------------
      String PhoneF = simmapplicantwithgson.mapplicantContact.emergencyContact.phone;
      if(PhoneF.length() == 10){
        PhoneF = PhoneF.substring(0,3)+"-"+PhoneF.substring(3,6)+"-"+PhoneF.substring(6,10);
      }
      else if((PhoneF.length() == 9)){
        PhoneF = PhoneF.substring(0,2)+"-"+PhoneF.substring(2,5)+"-"+PhoneF.substring(5,9);
      }

      sizeColumn = new float[]{45.0f,55.0f};
      detail = new PdfPTable(2);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(10.0f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(4.5f);
      detail.addCell(getCellData("Person to be notified in Case of Emergency :", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(simmapplicantwithgson.mapplicantContact.emergencyContact.name, font_C10N, "R_BOTTOM", "LEFT", "MIDDLE", 1, 1));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("กรณีฉุกเฉินบุคคลที่ติดต่อได้ แจ้งชื่อ - นามสกุล", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      setPaddingTop(10.0f);
      setPaddingBottom(4.5f);
      content = new Phrase();
      content.add(new Chunk("Related to the Applicant as  ",font_C10B));
      content.add(new Chunk("เกี่ยวข้องกับผู้สมัคร :",font_C10N));
      detail.addCell(getCellData2( content, "NO", "LEFT", "MIDDLE",  1,  1) );
      detail.addCell(getCellData(simmapplicantwithgson.mapplicantContact.emergencyContact.relations, font_C10N, "R_BOTTOM", "LEFT", "MIDDLE", 1, 1));
      document.add(detail);
      // --------------- new line -----------------
      sizeColumn = new float[]{10.0f,45.0f,6.0f,39.0f};
      detail = new PdfPTable(4);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(10.0f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(4.5f);
      detail.addCell(getCellData("Address:", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(simmapplicantwithgson.mapplicantContact.emergencyContact.address, font_C10N, "R_BOTTOM", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData("Tel.: ", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(PhoneF, font_C10N, "R_BOTTOM", "LEFT", "MIDDLE", 1, 1));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("ที่อยู่", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("โทร", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      document.add(detail);
      // --------------- new line -----------------
      Boolean policecapture =simmapplicantwithgson.mapplicantOther.policecapture.status;
      String explain = simmapplicantwithgson.mapplicantOther.policecapture.explain;
      sizeColumn = new float[]{70.0f,5.0f,10.0f,5.0f,5.0f};
      detail = new PdfPTable(5);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(7.5f);
      setPaddingBottom(3.5f);
      detail.addCell(getCellData("Have you ever been involved in convicted of any criminal offence? ", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData("Yes", font_C10B, "NO", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData(policecapture? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "LEFT", "BOTTOM", 1, 1));
      detail.addCell(getCellData("No", font_C10B, "NO", "LEFT", "TOP", 1, 1,true,false));
      detail.addCell(getCellData(!policecapture? AwesomeIcons.ICON_CHECK:AwesomeIcons.ICON_CHECK_EMPTY, fontAwesome, "NO", "LEFT", "BOTTOM", 1, 1));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("ท่านเคยมีส่วนร่วมพัวพันหรือต้องโทษในคดีอาญาหรือไม่", font_C10N, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData("เคย", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      detail.addCell(getCellData("ไม่เคย", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      document.add(detail);
      // --------------- new line -----------------
      sizeColumn = new float[]{33.0f,67.0f};
      detail = new PdfPTable(2);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(10.0f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(4.5f);
      detail.addCell(getCellData("If yes, (Please outline the case):", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(policecapture?chk.chkNullString(explain):" ", font_C10N, "R_BOTTOM", "LEFT", "MIDDLE", 1, 1));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("ถ้ามี โปรดแจ้งคดี", font_C10N, "NO", "LEFT", "MIDDLE", 2, 1));
      document.add(detail);
      // --------------- new line -----------------
      sizeColumn = new float[]{100.0f};
      detail = new PdfPTable(1);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(10.0f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(4.5f);
      detail.addCell(getCellData("Sources of Job Information, Please Specific (If you have got reference from Kokotel’s Staff, please put staff’s", font_C10N, "NO", "LEFT", "MIDDLE", 1, 1));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("name): ทราบข่าวการรับสมัครจากแหล่งใด โปรดระบุ (หากทราบจากพนักงานโคโคเทล โปรดระบุชื่อ):", font_C10N, "NO", "LEFT", "MIDDLE", 1, 1));
      setPaddingTop(10.0f);
      setPaddingBottom(4.5f);
      detail.addCell(getCellData(sourcejobDesc, font_C10N, "R_BOTTOM", "LEFT", "MIDDLE", 1, 1,false,false));
      document.add(detail);
      // --------------- new line -----------------
      String dateavailable = simmapplicantwithgson.mapplicantPersonal.dateavailable.substring(0,10);
      String dateavailable2 = new CscCalendar(dateavailable).getThaiDDMMYYYY().replaceAll("-","/");
      sizeColumn = new float[]{15.0f,10.0f,42.0f,30.0f};
      detail = new PdfPTable(4);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(20.0f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(4.5f);
      detail.addCell(getCellData("Notice Period:", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(simmapplicantwithgson.mapplicantOther.presentemployer, font_C10N, "R_BOTTOM", "CENTER", "MIDDLE", 1, 1));
      detail.addCell(getCellData("Days. When would you be available to start?", font_C10B, "NO", "LEFT", "MIDDLE", 1, 1));
      detail.addCell(getCellData(dateavailable2, font_C10N, "R_BOTTOM", "LEFT", "MIDDLE", 1, 1));
      setPaddingTop(4.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("ท่านสามารถเริ่มงานได้เมื่อไร", font_C10N, "NO", "LEFT", "MIDDLE", 4, 1));
      document.add(detail);


      // PAGE 5
      document.newPage();
      pagenumber++;
      ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, new Phrase(String.valueOf(pagenumber), font_C08B), 300, 810, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, Header1, 300, 790, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, Header2, 300, 775, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, Header3, 300, 762, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_RIGHT, Footer1, 500, 40, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_RIGHT, Footer2, 500, 30, 0);
      ColumnText.showTextAligned(canvas, Element.ALIGN_RIGHT, Footer3, 500, 20, 0);
      document.add(imgFooter);

      // --------------- new line -----------------
      String idealtoperform =  simmapplicantwithgson.mapplicantOther.idealtoperform;
      sizeColumn = new float[]{100.0f};
      detail = new PdfPTable(1);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(0.5f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(4.5f);
      detail.addCell(getCellData("Please provide any further information about yourself which will allow our company to know you better", font_C10N, "NO", "LEFT", "MIDDLE", 1, 1));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("กรุณาแนะนำตัวท่านเอง เพื่อให้บริษัทรู้จักตัวท่านดีขึ้น", font_C10N, "NO", "LEFT", "MIDDLE", 1, 1));
      setPaddingTop(30.5f);
      setPaddingBottom(4.5f);

      content = new Phrase();
      Chunk idealform = new Chunk("     "+idealtoperform,font_C10N);
 
      content = new Phrase();
      content.add(idealform);
      detail.addCell(getCellData2( content, "NO", "LEFT", "MIDDLE",  1,  1,false,false) );
      

     
      document.add(detail);
      // --------------- new line -----------------
      sizeColumn = new float[]{100.0f};
      detail = new PdfPTable(1);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(50.0f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(4.5f);
      detail.addCell(getCellData("            I certify all statement and information given by me within this application form are true. If there is any untrue identification is found after engagement. The Company has right to terminate my employment without any compensation or severance pay whatsoever. I also authorize any investigation of the above information as deemed necessary.", font_C10N, "NO", "LEFT", "MIDDLE", 1, 1));
      setPaddingTop(0.5f);
      setPaddingBottom(0.5f);
      detail.addCell(getCellData("            ข้าพเจ้าขอรับรองว่า ข้อความดังกล่าวทั้งหมดในใบสมัครนี้เป็นความจริงทุกประการ หลังจากบริษัทจ้างเข้ามา\nทำงานแล้วปรากฏว่าข้อความในใบสมัครงาน เอกสารที่นำมาแสดงหรือรายละเอียดที่ให้ไว้ไม่เป็นความจริง บริษัทฯมีสิทธิ์ที่\nจะเลิกจ้างข้าพได้โดยไม่ต้องจ่ายเงินชดเชยหรือค่าเสียหายใดๆทั้งสิ้น รวมถึงสามารถตรวจสอบข้อมูลข้างต้นได้เมื่อจำเป็น", font_C10N, "NO", "LEFT", "MIDDLE", 1, 1));

      document.add(detail);
      // --------------- new line -----------------
      sizeColumn = new float[]{50.0f,10.0f,40.0f};
      detail = new PdfPTable(3);
      detail.setWidthPercentage(90);
      detail.setWidths(sizeColumn);
      setPaddingTop(50.0f);
      setPaddingLeft(3.5f);
      setPaddingRight(3.5f);
      setPaddingBottom(4.5f);
      detail.addCell(getCellData(langthai? FullnameThai:FullnameEng, font_C10N, "R_BOTTOM", "CENTER", "MIDDLE", 1, 1));
      detail.addCell(getCellData(" ", font_C10N, "NO", "LEFT", "MIDDLE", 1, 2));
      detail.addCell(getCellData(new CscCalendar(screen.getString("applicantdate")).getDDMMYYYY().replaceAll("-","/"), font_C10N, "R_BOTTOM", "CENTER", "MIDDLE", 1, 1));
      setPaddingTop(4.5f);
      setPaddingBottom(4.5f);
      content = new Phrase();
      content.add(new Chunk("Applicant signature  ",font_C10B));
      content.add(new Chunk("(ลายมือชื่อผู้สมัคร)",font_C10N));
      detail.addCell(getCellData2( content, "NO", "LEFT", "MIDDLE",  1,  1) );
      content = new Phrase();
      content.add(new Chunk("Date  ",font_C10B));
      content.add(new Chunk("(วันที่)",font_C10N));
      detail.addCell(getCellData2( content, "NO", "LEFT", "MIDDLE",  1,  1) );
      document.add(detail);


      // -----------------------------------------------------------------------------
      } catch (Exception e) {
        e.printStackTrace();
      } finally {
        document.close();
      }
    }

    if (hasData) {
      OutputStream os = response.getOutputStream();
    // Create a reader
      PdfReader reader = new PdfReader(baos.toByteArray());
    // Create a stamper
      PdfStamper stamper = new PdfStamper(reader, baos);

    // Close the stamper
      stamper.close();
      reader.close();

      response.setHeader("Expires", "0");
      response.setHeader("Cache-Control", "must-revalidate, post-check=0 , pre-check=0");
      response.setHeader("Pragma", "public");

    // setting the content type
      response.setContentType("application/pdf");
    // the contentlength
      response.setContentLength(baos.size());
    // write ByteArrayOutputStream to the ServletOutputStream

      baos.writeTo(os);

      os.flush();
      os.close(); 
    }
    //PdfWriter.getInstance(document, baos);
    %>

    <%!
    Float padding = 0.0f;
    Float paddingtop = 0.0f;
    Float paddingbottom = 0.0f;
    Float paddingleft = 0.0f;
    Float paddingright = 0.0f;
    BaseColor basecolor = new BaseColor(0, 0, 0);

    private PdfPCell getCellData(String text, Font font, String noborder, String horalign, String veralign, int colspan, int rowspan) {
      return getCellData(text, font, noborder, horalign, veralign, colspan, rowspan, false,false);
    }
   
    //get call data
    private PdfPCell getCellData(String text, Font font, String noborder, String horalign, String veralign, int colspan, int rowspan,boolean setheight, boolean bgcolor) {
      PdfPCell cellDetail = new PdfPCell(new Phrase(text, font));
      cellDetail.setNoWrap(false);
    //  cellDetail.setNoWrap(true);

      if (horalign.equalsIgnoreCase("LEFT")) {
        cellDetail.setHorizontalAlignment(Element.ALIGN_LEFT);
      } else if (horalign.equalsIgnoreCase("CENTER")) {
        cellDetail.setHorizontalAlignment(Element.ALIGN_CENTER);
      } else if (horalign.equalsIgnoreCase("RIGHT")) {
        cellDetail.setHorizontalAlignment(Element.ALIGN_RIGHT);
      }

      if (veralign.equalsIgnoreCase("TOP")) {
        cellDetail.setVerticalAlignment(Element.ALIGN_TOP);
      } else if (veralign.equalsIgnoreCase("MIDDLE")) {
        cellDetail.setVerticalAlignment(Element.ALIGN_MIDDLE);
      } else if (veralign.equalsIgnoreCase("BOTTOM")) {
        cellDetail.setVerticalAlignment(Element.ALIGN_BOTTOM);
      }

      if (padding > 0.0f) {
        cellDetail.setPadding(padding);
      }
      if (paddingtop > 0.0f) {
        cellDetail.setPaddingTop(paddingtop);
      }
      if (paddingbottom > 0.0f) {
        cellDetail.setPaddingBottom(paddingbottom);
      }
      if (paddingleft > 0.0f) {
        cellDetail.setPaddingLeft(paddingleft);
      }
      if (paddingright > 0.0f) {
        cellDetail.setPaddingRight(paddingright);
      }
      if (colspan > 0) {
        cellDetail.setColspan(colspan);
      }
      if (rowspan > 0) {
        cellDetail.setRowspan(rowspan);
      }

      if (noborder.equalsIgnoreCase("NO")) {
        cellDetail.setBorder(Rectangle.NO_BORDER);
      }
      else if(noborder.equalsIgnoreCase("R_TOP")){ 
            cellDetail.setBorder(Rectangle.TOP );
      } 
      else if(noborder.equalsIgnoreCase("R_TL")){ 
            cellDetail.setBorder(Rectangle.TOP | Rectangle.LEFT);
      } 
      else if(noborder.equalsIgnoreCase("R_TR")){ 
            cellDetail.setBorder(Rectangle.TOP | Rectangle.RIGHT);
      } 
      else if(noborder.equalsIgnoreCase("R_LR")){ 
            cellDetail.setBorder(Rectangle.LEFT | Rectangle.RIGHT);
      } 
      else if(noborder.equalsIgnoreCase("R_RB")){ 
            cellDetail.setBorder(Rectangle.RIGHT | Rectangle.BOTTOM);
      } 
      else if(noborder.equalsIgnoreCase("R_TB")){ 
            cellDetail.setBorder(Rectangle.TOP | Rectangle.BOTTOM);
      } 
      else if(noborder.equalsIgnoreCase("R_TLR")){ 
            cellDetail.setBorder(Rectangle.TOP | Rectangle.LEFT | Rectangle.RIGHT);
      } 
      else if(noborder.equalsIgnoreCase("R_LRB")){ 
            cellDetail.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
      } 
       else if(noborder.equalsIgnoreCase("R_TLB")){ 
            cellDetail.setBorder(Rectangle.TOP | Rectangle.LEFT | Rectangle.BOTTOM);
      } 
      else if(noborder.equalsIgnoreCase("R_TRB")){ 
            cellDetail.setBorder(Rectangle.TOP | Rectangle.RIGHT | Rectangle.BOTTOM);
      } 
      else if(noborder.equalsIgnoreCase("R_BOTTOM")){ 
            cellDetail.setBorder(Rectangle.BOTTOM);
      }
      else if(noborder.equalsIgnoreCase("R_RIGHT")){ 
            cellDetail.setBorder(Rectangle.RIGHT);
      }
      else if(noborder.equalsIgnoreCase("R_LEFT")){ 
            cellDetail.setBorder(Rectangle.LEFT);
      }
      else{

      }
      if (bgcolor) {
        cellDetail.setBackgroundColor(basecolor);
      } 
      if (setheight) {
        cellDetail.setFixedHeight(0.6999512f);
      } 
      return cellDetail;
    }


    //CellDeatail2 Use For Add Chunk(1row 2 Fonts Or Color)
    private PdfPCell getCellData2(Phrase content, String noborder, String horalign, String veralign, int colspan, int rowspan) {
      return getCellData2(content, noborder, horalign, veralign, colspan, rowspan, false,false);
    }
    private PdfPCell getCellData2(Phrase content, String noborder, String horalign, String veralign, int colspan, int rowspan,boolean setheight, boolean bgcolor) {
      PdfPCell cellDetail2 = new PdfPCell(new Phrase(content));
        cellDetail2.setNoWrap(false);
      if (horalign.equalsIgnoreCase("LEFT")) {
        cellDetail2.setHorizontalAlignment(Element.ALIGN_LEFT);
      } else if (horalign.equalsIgnoreCase("CENTER")) {
        cellDetail2.setHorizontalAlignment(Element.ALIGN_CENTER);
      } else if (horalign.equalsIgnoreCase("RIGHT")) {
        cellDetail2.setHorizontalAlignment(Element.ALIGN_RIGHT);
      }

      if (veralign.equalsIgnoreCase("TOP")) {
        cellDetail2.setVerticalAlignment(Element.ALIGN_TOP);
      } else if (veralign.equalsIgnoreCase("MIDDLE")) {
        cellDetail2.setVerticalAlignment(Element.ALIGN_MIDDLE);
      } else if (veralign.equalsIgnoreCase("BOTTOM")) {
        cellDetail2.setVerticalAlignment(Element.ALIGN_BOTTOM);
      }

      if (padding > 0.0f) {
        cellDetail2.setPadding(padding);
      }
      if (paddingtop > 0.0f) {
        cellDetail2.setPaddingTop(paddingtop);
      }
      if (paddingbottom > 0.0f) {
        cellDetail2.setPaddingBottom(paddingbottom);
      }
      if (paddingleft > 0.0f) {
        cellDetail2.setPaddingLeft(paddingleft);
      }
      if (paddingright > 0.0f) {
        cellDetail2.setPaddingRight(paddingright);
      }
      if (colspan > 0) {
        cellDetail2.setColspan(colspan);
      }
      if (rowspan > 0) {
        cellDetail2.setRowspan(rowspan);
      }

      if (noborder.equalsIgnoreCase("NO")) {
        cellDetail2.setBorder(Rectangle.NO_BORDER);
      }
      else if(noborder.equalsIgnoreCase("R_TOP")){ 
        cellDetail2.setBorder(Rectangle.TOP );
      } 
      else if(noborder.equalsIgnoreCase("R_TR")){ 
            cellDetail2.setBorder(Rectangle.TOP | Rectangle.RIGHT);
      } 
      else if(noborder.equalsIgnoreCase("R_LR")){ 
            cellDetail2.setBorder(Rectangle.LEFT | Rectangle.RIGHT);
      } 
       else if(noborder.equalsIgnoreCase("R_RB")){ 
            cellDetail2.setBorder(Rectangle.RIGHT | Rectangle.BOTTOM);
      } 
      else if(noborder.equalsIgnoreCase("R_TB")){ 
            cellDetail2.setBorder(Rectangle.TOP | Rectangle.BOTTOM);
      } 
      else if(noborder.equalsIgnoreCase("R_TLR")){ 
            cellDetail2.setBorder(Rectangle.TOP | Rectangle.LEFT | Rectangle.RIGHT);
      } 
      else if(noborder.equalsIgnoreCase("R_LRB")){ 
            cellDetail2.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
      } 
       else if(noborder.equalsIgnoreCase("R_TLB")){ 
            cellDetail2.setBorder(Rectangle.TOP | Rectangle.LEFT | Rectangle.BOTTOM);
      } 
      else if(noborder.equalsIgnoreCase("R_TRB")){ 
            cellDetail2.setBorder(Rectangle.TOP | Rectangle.RIGHT | Rectangle.BOTTOM);
      } 
      else if(noborder.equalsIgnoreCase("R_BOTTOM")){ 
            cellDetail2.setBorder(Rectangle.BOTTOM);
      }
      else if(noborder.equalsIgnoreCase("R_RIGHT")){ 
            cellDetail2.setBorder(Rectangle.RIGHT);
      }
      if (bgcolor) {
        cellDetail2.setBackgroundColor(basecolor);
      }
      if (setheight) {
        cellDetail2.setFixedHeight(0.6999512f);
      } 
      return cellDetail2;
    }
    
    private void setPadding(Float padding) {
      this.padding = padding;
    }

    private void setPaddingTop(Float padding) {
      this.paddingtop = padding;
    }

    private void setPaddingBottom(Float padding) {
      this.paddingbottom = padding;
    }

    private void setPaddingLeft(Float padding) {
      this.paddingleft = padding;
    }

    private void setPaddingRight(Float padding) {
      this.paddingright = padding;
    }

    private void setBaseBackgroundColor(int r, int g, int b) {
      this.basecolor = new BaseColor(r, g, b);
    }
   // Add IMAGE IN PART
    private String getImagePath(String type, String subFolder, String imageFileName, String defaultFile) {
      InitialEnvironment inv = new InitialEnvironment("GLOBAL");
      String path = inv.getValue(type)+subFolder;
      if (!new File(path+imageFileName).exists() || imageFileName.equals("")){
        imageFileName = defaultFile;
      }
      return path+imageFileName;
    }

    %>
    </body>
    </html>