Example #1
0
        /// <summary>
        /// Creates a new
        /// <see cref="BodyTagWorker"/>
        /// instance.
        /// </summary>
        /// <param name="element">the element</param>
        /// <param name="context">the context</param>
        public BodyTagWorker(IElementNode element, ProcessorContext context)
            : base(element, context)
        {
            parentTagWorker = context.GetState().Empty() ? null : context.GetState().Top();
            if (parentTagWorker != null && parentTagWorker.GetElementResult() != null)
            {
                // TODO this is not in css applier because css applier is called after the elements are added to the document
                // We need to apply font styles here specifically to set font-size to the document because this is needed for
                // inline-blocks with fixed height when the height is smaller than the defined font size
                float em = CssUtils.ParseAbsoluteLength(element.GetStyles().Get(CssConstants.FONT_SIZE));
                if (em != 0)
                {
                    parentTagWorker.GetElementResult().SetProperty(Property.FONT_SIZE, UnitValue.CreatePointValue(em));
                }
            }
            PdfDocument pdfDocument = context.GetPdfDocument();

            if (pdfDocument != null)
            {
                lang = element.GetAttribute(AttributeConstants.LANG);
                if (lang != null)
                {
                    pdfDocument.GetCatalog().SetLang(new PdfString(lang, PdfEncodings.UNICODE_BIG));
                }
            }
            else
            {
                lang = element.GetLang();
            }
        }
Example #2
0
        /// <summary>
        /// Creates a new
        /// <see cref="BodyTagWorker"/>
        /// instance.
        /// </summary>
        /// <param name="element">the element</param>
        /// <param name="context">the context</param>
        public BodyTagWorker(IElementNode element, ProcessorContext context)
            : base(element, context)
        {
            parentTagWorker = context.GetState().Empty() ? null : context.GetState().Top();
            PdfDocument pdfDocument = context.GetPdfDocument();

            if (pdfDocument != null)
            {
                lang = element.GetAttribute(AttributeConstants.LANG);
                if (lang != null)
                {
                    pdfDocument.GetCatalog().SetLang(new PdfString(lang, PdfEncodings.UNICODE_BIG));
                }
            }
            else
            {
                lang = element.GetLang();
            }
        }