Reputation: 163
I created custom tag using PdfHTML.
<condition align="right">Text</condition>
Created custom tag for "condition" to change the value of "Text". It worked. It appeared as "P tag" in the pdf. But it doesn't take attribute align="right". I is always left aligned. How can I set attributes. Created custom css class with below code segment to text alignment.
if (container != null && cssProps.containsKey(CssConstants.TEXT_ALIGN)) {
cssProps.put(CssConstants.TEXT_ALIGN, "right");
BackgroundApplierUtil.applyBackground(cssProps, context, container);
}
It doesn't work. Please help me to solve this. Thanks in advance
Upvotes: 0
Views: 718
Reputation: 163
Finally I found the answer. My mistake is using, "BackgroundApplierUtil.applyBackground(cssProps, context, container)" to apply font.
if (container != null && cssProps.containsKey(CssConstants.TEXT_ALIGN)) {
cssProps.put(CssConstants.TEXT_ALIGN, "right");
FontStyleApplierUtil.ApplyFontStyles(cssProps, context,stylecontainer ,container);
}
Thanks all.
Upvotes: 1
Reputation: 800
This link details everything you need to know about custom tags within iText PDF.
Upvotes: 0