Collects XMLWorker's parsed elements.
Inheritance: IElementHandler
示例#1
0
        /// <summary>
        /// Using iTextSharp's HTML to PDF capabilities.
        /// </summary>
        public PdfPCell RenderHtml()
        {
            IElementHandler elementsHandler;

            if (RunDirection == PdfRunDirection.RightToLeft)
            {
                elementsHandler = new RtlElementsCollector();
            }
            else
            {
                elementsHandler = new SimpleElementsCollector();
            }

            processHtml(elementsHandler);

            var runDirection = RunDirection == PdfRunDirection.RightToLeft ? PdfWriter.RUN_DIRECTION_RTL : PdfWriter.RUN_DIRECTION_LTR;
            var cell         = new PdfPCell
            {
                RunDirection        = runDirection,
                HorizontalAlignment = Element.ALIGN_LEFT,
                UseAscender         = true,
                UseDescender        = true
            };

            var paragraph = RunDirection == PdfRunDirection.RightToLeft ?
                            ((RtlElementsCollector)elementsHandler).Paragraph :
                            ((SimpleElementsCollector)elementsHandler).Paragraph;

            cell.AddElement(paragraph);
            return(cell);
        }
示例#2
0
        /// <summary>
        /// Using iTextSharp's HTML to PDF capabilities.
        /// </summary>
        public PdfPCell RenderHtml()
        {
            IElementHandler elementsHandler;
            if (RunDirection == PdfRunDirection.RightToLeft)
            {
                elementsHandler = new RtlElementsCollector();
            }
            else
            {
                elementsHandler = new SimpleElementsCollector();
            }

            processHtml(elementsHandler);

            var runDirection = RunDirection == PdfRunDirection.RightToLeft ? PdfWriter.RUN_DIRECTION_RTL : PdfWriter.RUN_DIRECTION_LTR;
            var cell = new PdfPCell
            {
                RunDirection = runDirection,
                HorizontalAlignment = Element.ALIGN_LEFT,
                UseAscender = true,
                UseDescender = true
            };

            var paragraph = RunDirection == PdfRunDirection.RightToLeft ?
                                                        ((RtlElementsCollector)elementsHandler).Paragraph :
                                                        ((SimpleElementsCollector)elementsHandler).Paragraph;

            cell.AddElement(paragraph);
            return cell;
        }