Пример #1
0
        /* (non-Javadoc)
         * @see com.itextpdf.html2pdf.css.apply.ICssApplier#apply(com.itextpdf.html2pdf.attach.ProcessorContext, com.itextpdf.html2pdf.html.node.IStylesContainer, com.itextpdf.html2pdf.attach.ITagWorker)
         */
        public virtual void Apply(ProcessorContext context, IStylesContainer stylesContainer, ITagWorker tagWorker
                                  )
        {
            IDictionary <String, String> cssProps  = stylesContainer.GetStyles();
            IPropertyContainer           container = tagWorker.GetElementResult();

            if (container != null)
            {
                WidthHeightApplierUtil.ApplyWidthHeight(cssProps, context, container);
                BackgroundApplierUtil.ApplyBackground(cssProps, context, container);
                MarginApplierUtil.ApplyMargins(cssProps, context, container);
                PaddingApplierUtil.ApplyPaddings(cssProps, context, container);
                FontStyleApplierUtil.ApplyFontStyles(cssProps, context, stylesContainer, container);
                BorderStyleApplierUtil.ApplyBorders(cssProps, context, container);
                HyphenationApplierUtil.ApplyHyphenation(cssProps, context, stylesContainer, container);
                FloatApplierUtil.ApplyFloating(cssProps, context, container);
                PositionApplierUtil.ApplyPosition(cssProps, context, container);
                OpacityApplierUtil.ApplyOpacity(cssProps, context, container);
                PageBreakApplierUtil.ApplyPageBreakProperties(cssProps, context, container);
                OverflowApplierUtil.ApplyOverflow(cssProps, container);
                TransformationApplierUtil.ApplyTransformation(cssProps, context, container);
                OutlineApplierUtil.ApplyOutlines(cssProps, context, container);
                OrphansWidowsApplierUtil.ApplyOrphansAndWidows(cssProps, container);
            }
        }
Пример #2
0
        /* (non-Javadoc)
         * @see com.itextpdf.html2pdf.css.apply.ICssApplier#apply(com.itextpdf.html2pdf.attach.ProcessorContext, com.itextpdf.html2pdf.html.node.IStylesContainer, com.itextpdf.html2pdf.attach.ITagWorker)
         */
        public virtual void Apply(ProcessorContext context, IStylesContainer stylesContainer, ITagWorker tagWorker
                                  )
        {
            IDictionary <String, String> cssProps  = stylesContainer.GetStyles();
            IPropertyContainer           container = tagWorker.GetElementResult();

            if (container != null)
            {
                if (container is Div)
                {
                    if (!cssProps.ContainsKey(CssConstants.WIDTH) || CssConstants.AUTO.Equals(cssProps.Get(CssConstants.WIDTH)
                                                                                              ))
                    {
                        ((Div)container).SetWidth(DEFAULT_CONTENT_WIDTH_PT);
                    }
                    if (!cssProps.ContainsKey(CssConstants.HEIGHT) || CssConstants.AUTO.Equals(cssProps.Get(CssConstants.HEIGHT
                                                                                                            )))
                    {
                        ((Div)container).SetHeight(DEFAULT_CONTENT_HEIGHT_PT);
                    }
                }
                WidthHeightApplierUtil.ApplyWidthHeight(cssProps, context, container);
                BackgroundApplierUtil.ApplyBackground(cssProps, context, container);
            }
        }