public PdfPCell richTextRendering(PdfPCell pdfpCell, String HTML) throws DocumentException, IOException {
final String CSS = "";
HtmlPipelineContext htmlContext = new HtmlPipelineContext(null);
htmlContext.setTagFactory(Tags.getHtmlTagProcessorFactory());
CSSResolver cssResolver = new StyleAttrCSSResolver();
CssFile cssFile = XMLWorkerHelper.getCSS(new ByteArrayInputStream(CSS.getBytes()));
cssResolver.addCss(cssFile);
ElementList elements=new ElementList();
ElementHandlerPipeline pdf = new ElementHandlerPipeline(elements, null);
HtmlPipeline html = new HtmlPipeline(htmlContext, pdf);
CssResolverPipeline css = new CssResolverPipeline(cssResolver, html);
XMLWorker worker = new XMLWorker(css, false);
XMLParser p = new XMLParser(worker);
p.parse(new ByteArrayInputStream(HTML.getBytes()));
for (Element element : elements) {
pdfpCell.addElement(element);
}
return pdfpCell;
}
proposalDescriptionTableCell.setBorder(Rectangle.NO_BORDER);
String proposalDescriptionEnglish=proposalInformation.getProposalDescriptionEnglish().trim();
proposalDescriptionEnglish=proposalDescriptionEnglish.replaceAll("div", "p"); //XMLWorkerHelper not taking rendering <div> content its recommended to replace all the <div> with <p>
proposalDescriptionEnglish=proposalDescriptionEnglish.replaceAll("<br>", "<br/>");
proposalDescriptionEnglish="<p>"+proposalDescriptionEnglish+"</p>"; //some tags are not supported the plug-in keep the code inside the <p> for safe execution
proposalDescriptionTableCell=new CustomerViewPdfDelegationServiceImpl().richTextRendering(proposalDescriptionTableCell,proposalDescriptionEnglish); //getting the pdfPCell with HtmlRendered-Text
for my code all other tags are working except header tag please