Example #1
0
        public TextBox(PdfStyleText style, PdfTextAlign align, int maxLines, string text)
        {
            if (style is null)
            {
                throw new ArgumentNullException(nameof(style));
            }
            if (text is null)
            {
                throw new ArgumentNullException(nameof(text));
            }

            _setWidth = PdfDistance.NaN;
            _style    = style;
            _align    = align;
            _maxLines = maxLines;
            _text     = text;
        }
 public void                AddText(PdfDistance left, PdfDistance top, PdfDistance width, PdfStyleText style, PdfTextAlign align, int maxLines, string text)
 {
     Append(new TextBox(style, align, maxLines, text)
     {
         Fixed = true, Left = left, Top = top, Width = width
     });
 }
        public void                AddText(PdfStyleText style, PdfTextAlign align, int maxLines, string text)
        {
            TextBox TextBox = new TextBox(style, align, maxLines, text);

            Append(TextBox);
        }
Example #4
0
        public void                                Text(PdfStyleText textStyle, PdfPoint point, PdfTextAlign align, double rotation, string txt)
        {
            if (textStyle is null)
            {
                throw new ArgumentNullException(nameof(textStyle));
            }

            if (!string.IsNullOrEmpty(txt))
            {
                SetTextStyle(textStyle);

                rotation *= Math.PI / 180.0;

                double Rotation_Sin = Math.Round(Math.Sin(rotation), 5);
                double Rotation_Cos = Math.Round(Math.Cos(rotation), 5);

                if (align != PdfTextAlign.Left)
                {
                    PdfDistance Width = textStyle.Font.TextWidth(textStyle.FontSize, txt);

                    if (align == PdfTextAlign.Center)
                    {
                        Width = Width / 2.0;
                    }

                    point.x -= Width * Rotation_Cos;
                    point.y -= Width * Rotation_Sin;
                }

                SetTextMatrix(point, Rotation_Sin, Rotation_Cos);
                opShowText(txt, 0, txt.Length);
            }
        }
Example #5
0
        public void                                Text(PdfStyleText textStyle, PdfPoint point, PdfTextAlign align, string txt)
        {
            if (textStyle is null)
            {
                throw new ArgumentNullException(nameof(textStyle));
            }

            if (!string.IsNullOrEmpty(txt))
            {
                SetTextStyle(textStyle);

                if (align != PdfTextAlign.Left)
                {
                    PdfDistance Width = textStyle.Font.TextWidth(textStyle.FontSize, txt);

                    switch (align)
                    {
                    case PdfTextAlign.Right:    point.x -= Width;       break;

                    case PdfTextAlign.Center:   point.x -= Width / 2;   break;
                    }
                }

                SetTextMatrixH(point);
                opShowText(txt, 0, txt.Length);
            }
        }
Example #6
0
 public void                                TextBox(PdfPoint upperLeftCorner, PdfStyleText style, PdfTextAlign align, PdfDistance width, int maxLines, string text)
 {
     if (!string.IsNullOrEmpty(text))
     {
         Formatter.TextBox TextBox = new Formatter.TextBox(style, align, width, maxLines, text);
         TextBox.Print(upperLeftCorner, this);
     }
 }
 protected TableColumnRow()
 {
     _textAlign    = PdfTextAlign.Unknown;
     _textMaxLines = 0;
 }