Ejemplo n.º 1
0
        public void Render(PdfContentByte itextContent)
        {
            iTextSharp.text.pdf.ColumnText itextText = new iTextSharp.text.pdf.ColumnText(itextContent);
            itextText.SetSimpleColumn(ObjectLayoutContainer.Layout.Left.Points, ObjectLayoutContainer.Layout.Top.Points,
                                      ObjectLayoutContainer.Layout.Right.Points,
                                      ObjectLayoutContainer.Layout.Bottom.Points);

            Paragraph pdfContentParagraph = new Paragraph();

            itextText.AddElement(pdfContentParagraph);

            if (_textlines.Count > 0)
            {
                Models.Text.Paragraph currentParagraph = _textlines.First().ParagraphModel;
                pdfContentParagraph.Leading   = currentParagraph.Leading.Points;
                pdfContentParagraph.Alignment = (int)currentParagraph.Alignment;
                foreach (Textline textline in _textlines)
                {
                    if (currentParagraph != textline.ParagraphModel)
                    {
                        pdfContentParagraph           = new Paragraph(textline.ParagraphModel.Leading.Points);
                        pdfContentParagraph.Alignment = (int)textline.ParagraphModel.Alignment;
                        itextText.AddElement(pdfContentParagraph);
                    }
                    textline.Render(pdfContentParagraph);
                    currentParagraph = textline.ParagraphModel;
                }
                itextText.Go();
            }
        }
Ejemplo n.º 2
0
        private Textline(PdfDocument pdfDocument, Models.Text.Textline bTextline)
        {
            _textElements          = new List <TextElement>();
            _leading               = bTextline.Height.Points;
            _alignment             = (int)bTextline.Alignment;
            _isLastlineOfParagraph = bTextline.EndsParagraph;
            _paragraphModel        = bTextline.Paragraph;

            foreach (Models.Text.TextElement bTextElement in bTextline)
            {
                _textElements.Add(TextElement.Parse(pdfDocument, bTextElement));
            }
        }