Beispiel #1
0
        private IByteContainer AlignJustify(IByteContainer sbBuffered, double currentLineLength, bool isLastLineOfParagraph, int horizontalMargin, int yPosition, ref double previousLineLength)
        {
            if (previousLineLength >= 0)
            {
                sbBuffered.Append(string.Format("1 0 0 1 {0} {1} Tm ", horizontalMargin, yPosition));
                previousLineLength = -1;
            }

            if (currentLineLength > 0)
            {
                double scaleFactor;
                if (isLastLineOfParagraph)
                    scaleFactor = 100;
                else
                    scaleFactor = _size.Width / currentLineLength * 100;

                sbBuffered.Append(string.Format("{0:0.###} Tz ", scaleFactor).Replace(',', '.'));
            }

            return sbBuffered;
        }
Beispiel #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sbBuffered"></param>
        /// <param name="currentLineLength"></param>
        /// <param name="previousLineLength">
        ///     is needed because when we change the start of a line, the starting position of the next line
        ///     will be relative to this new position
        /// </param>
        /// <returns></returns>
        private IByteContainer AlignRight(IByteContainer sbBuffered, double currentLineLength, ref double previousLineLength)
        {
            double xOffset;
            if (previousLineLength < 0)
                xOffset = _size.Width - (currentLineLength);
            else
                xOffset = (previousLineLength - currentLineLength);

            sbBuffered.Append(string.Format("{0:0.###} 0 Td ", xOffset).Replace(',', '.'));

            previousLineLength = currentLineLength;
            return sbBuffered;
        }
Beispiel #3
0
        private static IByteContainer AlignLeft(IByteContainer sbBuffered, int horizontalMargin, int yPosition, ref double previousLineLength)
        {
            if (previousLineLength >= 0)
            {
                sbBuffered.Append(string.Format("1 0 0 1 {0} {1} Tm ", horizontalMargin, yPosition));
                previousLineLength = -1;
            }

            sbBuffered.Append("100 Tz ");
            return sbBuffered;
        }