////////////////////////////////////////////////////////////////////
        // Draw text within text box center or right justified
        ////////////////////////////////////////////////////////////////////
        private Double DrawText(
			Double			PosX,
			Double			PosY,
			Double			Width,
			TextBoxJustify	Justify,
			TextBoxLine		Line,
			PdfPage			Page
			)
        {
            Double LineWidth = 0;
            foreach(TextBoxSeg Seg in Line.SegArray) LineWidth += Seg.SegWidth;

            Double SegPosX = PosX;
            if(Justify == TextBoxJustify.Right) SegPosX += Width - LineWidth;
            else SegPosX += 0.5 * (Width - LineWidth);
            foreach(TextBoxSeg Seg in Line.SegArray)
            {
            Double SegWidth = DrawText(Seg.Font, Seg.FontSize, SegPosX, PosY, TextJustify.Left, Seg.DrawStyle, Seg.FontColor, Seg.Text);
            if(Seg.WebLink != null)
                {
                if(Page == null) throw new ApplicationException("TextBox with WebLink. You must call DrawText with PdfPage");
                Page.AddWebLink(SegPosX, PosY - Seg.Font.DescentPlusLeading(Seg.FontSize), SegPosX + SegWidth, PosY + Seg.Font.AscentPlusLeading(Seg.FontSize), Seg.WebLink);
                }

            SegPosX += SegWidth;
            }

            return(SegPosX - PosX);
        }
        ////////////////////////////////////////////////////////////////////
        // Draw text justify to width within text box
        ////////////////////////////////////////////////////////////////////
        private Double DrawText(
			Double		PosX,
			Double		PosY,
			Double		Width,
			TextBoxLine	Line,
			PdfPage		Page
			)
        {
            Double WordSpacing;
            Double CharSpacing;
            if(!TextFitToWidth(Width, out WordSpacing, out CharSpacing, Line)) return(DrawText(PosX, PosY, Line, Page));
            SaveGraphicsState();
            SetWordSpacing(WordSpacing);
            SetCharacterSpacing(CharSpacing);

            Double SegPosX = PosX;
            foreach(TextBoxSeg Seg in Line.SegArray)
            {
            Double SegWidth = DrawText(Seg.Font, Seg.FontSize, SegPosX, PosY, TextJustify.Left, Seg.DrawStyle, Seg.FontColor, Seg.Text) + Seg.SpaceCount * WordSpacing + Seg.Text.Length * CharSpacing;
            if(Seg.WebLink != null)
                {
                if(Page == null) throw new ApplicationException("TextBox with WebLink. You must call DrawText with PdfPage");
                Page.AddWebLink(SegPosX, PosY - Seg.Font.DescentPlusLeading(Seg.FontSize), SegPosX + SegWidth, PosY + Seg.Font.AscentPlusLeading(Seg.FontSize), Seg.WebLink);
                }
            SegPosX += SegWidth;
            }
            RestoreGraphicsState();
            return(SegPosX - PosX);
        }
        ////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Draw web link with one line of text
        /// </summary>
        /// <param name="Page">Current page</param>
        /// <param name="Font">Font</param>
        /// <param name="FontSize">Font size</param>
        /// <param name="TextAbsPosX">Text absolute position X</param>
        /// <param name="TextAbsPosY">Text absolute position Y</param>
        /// <param name="Justify">Text justify enumeration.</param>
        /// <param name="DrawStyle">Draw style enumeration</param>
        /// <param name="TextColor">Color</param>
        /// <param name="Text">Text</param>
        /// <param name="WebLink">Web link</param>
        /// <returns>Text width</returns>
        /// <remarks>
        ///	The position arguments are in relation to the
        ///	bottom left corner of the paper.
        /// </remarks>
        ////////////////////////////////////////////////////////////////////
        public Double DrawWebLink(
			PdfPage		Page,
			PdfFont		Font,
			Double		FontSize,		// in points
			Double		TextAbsPosX,
			Double		TextAbsPosY,
			TextJustify	Justify,
			DrawStyle	DrawStyle,
			Color		TextColor,
			String		Text,
			String		WebLink
			)
        {
            Double Width = DrawText(Font, FontSize, TextAbsPosX, TextAbsPosY, Justify, DrawStyle, TextColor, Text);
            if(Width == 0.0) return(0.0);

            // adjust position
            switch(Justify)
            {
            // right
            case TextJustify.Right:
                TextAbsPosX -= Width;
                break;

            // center
            case TextJustify.Center:
                TextAbsPosX -= 0.5 * Width;
                break;
            }

            Page.AddWebLink(TextAbsPosX, TextAbsPosY - Font.DescentPlusLeading(FontSize), TextAbsPosX + Width, TextAbsPosY + Font.AscentPlusLeading(FontSize), WebLink);
            return(Width);
        }