Ejemplo n.º 1
0
        /* (non-Javadoc)
         * @see com.itextpdf.html2pdf.css.apply.impl.BlockCssApplier#apply(com.itextpdf.html2pdf.attach.ProcessorContext, com.itextpdf.html2pdf.html.node.IStylesContainer, com.itextpdf.html2pdf.attach.ITagWorker)
         */
        public override void Apply(ProcessorContext context, IStylesContainer stylesContainer, ITagWorker worker)
        {
            base.Apply(context, stylesContainer, worker);
            IPropertyContainer cell = worker.GetElementResult();

            if (cell != null)
            {
                IDictionary <String, String> cssProps = stylesContainer.GetStyles();
                VerticalAlignmentApplierUtil.ApplyVerticalAlignmentForCells(cssProps, context, cell);
                float    em           = CssUtils.ParseAbsoluteLength(cssProps.Get(CssConstants.FONT_SIZE));
                float    rem          = context.GetCssContext().GetRootFontSize();
                Border[] bordersArray = BorderStyleApplierUtil.GetBordersArray(cssProps, em, rem);
                if (bordersArray[0] == null)
                {
                    cell.SetProperty(Property.BORDER_TOP, Border.NO_BORDER);
                }
                if (bordersArray[1] == null)
                {
                    cell.SetProperty(Property.BORDER_RIGHT, Border.NO_BORDER);
                }
                if (bordersArray[2] == null)
                {
                    cell.SetProperty(Property.BORDER_BOTTOM, Border.NO_BORDER);
                }
                if (bordersArray[3] == null)
                {
                    cell.SetProperty(Property.BORDER_LEFT, Border.NO_BORDER);
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>Parses the borders.</summary>
 /// <param name="styles">
 /// a
 /// <see cref="System.Collections.IDictionary{K, V}"/>
 /// containing the styles
 /// </param>
 /// <param name="em">a measurement expressed in em</param>
 /// <param name="rem">a measurement expressed in rem (root em)</param>
 private void ParseBorders(IDictionary <String, String> styles, float em, float rem)
 {
     borders = BorderStyleApplierUtil.GetBordersArray(styles, em, rem);
 }