Example #1
0
        private static void ApplyCommonLayoutAttributes(AbstractRenderer renderer, PdfDictionary attributes)
        {
            Color backgroundColor = renderer.GetPropertyAsColor(Property.BACKGROUND);

            if (backgroundColor != null && backgroundColor is DeviceRgb)
            {
                attributes.Put(PdfName.BackgroundColor, new PdfArray(backgroundColor.GetColorValue()));
            }
            //TODO NOTE: applying border attributes for cells is temporarily turned off on purpose. Remove this 'if' in future.
            // The reason is that currently, we can't distinguish if all cells have same border style or not.
            // Therefore for every cell in every table we have to write the same border attributes, which creates lots of clutter.
            if (!(renderer.GetModelElement() is Cell))
            {
                ApplyBorderAttributes(renderer, attributes);
            }
            ApplyPaddingAttribute(renderer, attributes);
            Color color = renderer.GetPropertyAsColor(Property.FONT_COLOR);

            if (color != null && color is DeviceRgb)
            {
                attributes.Put(PdfName.Color, new PdfArray(color.GetColorValue()));
            }
        }