public static iTextSharp.text.Paragraph Convert(Header heading)
{
iTextSharp.text.Font font = DefaultDocumentStyles.Instance().DefaultTextFont;
IStyle style = heading.Document.CommonStyles.GetStyleByName(heading.StyleName);
if (style != null && style is ParagraphStyle)
{
if ((ParagraphStyle)style != null)
{
if (((ParagraphStyle)style).ParentStyle != null)
{
IStyle parentStyle = heading.Document.CommonStyles.GetStyleByName(
((ParagraphStyle)style).ParentStyle);
if (parentStyle != null
&& parentStyle is ParagraphStyle
&& ((ParagraphStyle)parentStyle).TextProperties != null
&& ((ParagraphStyle)style).TextProperties != null)
{
// get parent style first
font = TextPropertyConverter.GetFont(((ParagraphStyle)parentStyle).TextProperties);
// now use the orignal style as multiplier
font = TextPropertyConverter.FontMultiplier(((ParagraphStyle)style).TextProperties, font);
}
else
{
font = TextPropertyConverter.GetFont(((ParagraphStyle)style).TextProperties);
}
}
else
{
font = TextPropertyConverter.GetFont(((ParagraphStyle)style).TextProperties);
}
}
}
iTextSharp.text.Paragraph paragraph = new iTextSharp.text.Paragraph("", font); // default ctor protected - why ??
paragraph.AddRange(FormatedTextConverter.GetTextContents(heading.TextContent, font));
return paragraph;
}
}