}
for (PdfPCell pdfpCell : pdfpCells) {
if (pdfpCell != null) {
ArrayList<Chunk> cList = pdfpCell.getChunks();
for (Chunk chunk : cList) {
Font setFont = FontFactory.getFont(fontLocal + "CALIBRI.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 8.5f);
/*processChunkHtml(htmlStr, chunk, setFont);
htmlStr = htmlStr.replaceFirst(chunk.getContent(), "<span />");*/
setFont.setColor(chunk.getFont().getColor());
setFont.setSize(chunk.getFont().getSize());
setFont.setStyle(chunk.getFont().getStyle());
chunk.setFont(setFont);
}
pdfpCell.setBorderWidth(0.1f);
pdfpCell.setPadding(5);
pdfpCell.setVerticalAlignment(PdfPCell.ALIGN_CENTER);
pdfpCell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
//pdfpCell.setBackgroundColor(new Color(221,221,221));
if(style != null){
if(i < style.size()){
if(style.get(i) != null){
String bgColor = style.get(i).get(HtmlTableStyleParser.BACKGROUND);
if(bgColor != null){
pdfpCell.setBackgroundColor(HtmlTableStyleParser.hex2Rgb(bgColor));
}else{
bgColor = style.get(i).get(HtmlTableStyleParser.BACKGROUNDCOLOR);
if(bgColor != null){
pdfpCell.setBackgroundColor(HtmlTableStyleParser.hex2Rgb(bgColor));
}
}
}
}
}
i++;
}
}
}
}
target.addElement(Chunk.NEWLINE);
//tmpPhrase.add(element);
//((PdfPTable)element).setSpacingBefore(5f);
//target.addElement(element);
((PdfPTable)element).setTotalWidth(width);
((PdfPTable)element).setLockedWidth(true);
target.addElement(element);
} else if (element instanceof Paragraph) {
if (font != null) {
ArrayList<Chunk> cList = ((Paragraph) element).getChunks();
//((Paragraph) element).setAlignment(PdfPCell.ALIGN_CENTER);
for (Chunk chunk : cList) {
Font setFont = FontFactory.getFont(fontLocal + "CALIBRI.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 8.5f);
processChunkHtml(htmlStr, chunk, setFont);
htmlStr = replaceContent(htmlStr, chunk.getContent());
/*htmlStr = htmlStr.replaceFirst(chunk.getContent(), "<span />");*/
/*setFont.setColor(chunk.getFont().getColor());
setFont.setSize(chunk.getFont().getSize());
setFont.setStyle(chunk.getFont().getStyle());
chunk.getAttributes();
chunk.setFont(setFont);*/
}
}
//tmpPhrase.add(element);
target.addElement(element);
} else if (element instanceof Phrase) {
if (font != null) {
ArrayList<Chunk> cList = ((Phrase) element).getChunks();
for (Chunk chunk : cList) {
Font setFont = FontFactory.getFont(fontLocal + "CALIBRI.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 8.5f);
processChunkHtml(htmlStr, chunk, setFont);
htmlStr = replaceContent(htmlStr, chunk.getContent());
/*htmlStr = htmlStr.replaceFirst(chunk.getContent(), "<span />");*/
/*setFont.setColor(chunk.getFont().getColor());
setFont.setSize(chunk.getFont().getSize());
setFont.setStyle(chunk.getFont().getStyle());
chunk.setFont(setFont);*/
}
}
target.addElement(/*tmpPhrase*/element);
} else if (element instanceof Chunk) {
if (font != null) {
Font setFont = FontFactory.getFont(fontLocal + "CALIBRI.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 8.5f);
processChunkHtml(htmlStr, (Chunk)element, setFont);
htmlStr = replaceContent(htmlStr, ((Chunk)element).getContent());
/*htmlStr = htmlStr.replaceFirst(((Chunk)element).getContent(), "<span />");*/
/*setFont.setColor(((Chunk) element).getFont().getColor());
setFont.setColor(((Chunk) element).getFont().getColor());
setFont.setSize(((Chunk) element).getFont().getSize());
setFont.setStyle(((Chunk) element).getFont().getStyle());
((Chunk) element).setFont(setFont);*/
}
//tmpPhrase.add(element);
target.addElement(element);
}else if(element instanceof com.lowagie.text.List){
com.lowagie.text.List list = (com.lowagie.text.List)element;
ArrayList<Chunk> cList = list.getChunks();
for (Chunk chunk : cList) {
Font setFont = FontFactory.getFont(fontLocal + "CALIBRI.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 8.5f);
processChunkHtml(htmlStr, chunk, setFont);
htmlStr = replaceContent(htmlStr, chunk.getContent());
/*htmlStr = htmlStr.replaceFirst(chunk.getContent(), "<span />");*/
/*setFont.setColor(chunk.getFont().getColor());
setFont.setSize(chunk.getFont().getSize());
setFont.setStyle(chunk.getFont().getStyle());
chunk.getAttributes();
chunk.setFont(setFont);*/
}
target.addElement(list);
}else{
Phrase p = new Phrase();
p.add(element);
ArrayList<Chunk> cList = p.getChunks();
for (Chunk chunk : cList) {
Font setFont = FontFactory.getFont(fontLocal + "CALIBRI.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 8.5f);
processChunkHtml(htmlStr, chunk, setFont);
htmlStr = replaceContent(htmlStr, chunk.getContent());
/*htmlStr = htmlStr.replaceFirst(chunk.getContent(), "<span />");*/
/*setFont.setColor(chunk.getFont().getColor());
setFont.setSize(chunk.getFont().getSize());