示例#1
0
        private void WriteText(String @operator, IList <PdfObject> operands, PdfArray cleanedText, PdfCanvas canvas
                               )
        {
            CanvasGraphicsState canvasGs = canvas.GetGraphicsState();
            bool newLineShowText         = "'".Equals(@operator) || "\"".Equals(@operator);

            if (newLineShowText)
            {
                if (canvasGs.GetLeading() != currLeading)
                {
                    canvas.SetLeading((float)currLeading);
                }
                // after new line operator, removed text shift doesn't matter
                removedTextShift = null;
            }
            PdfTextArray tjShiftArray = null;

            if (removedTextShift != null)
            {
                float tjShift = (float)removedTextShift * 1000 / (canvasGs.GetFontSize() * canvasGs.GetHorizontalScaling()
                                                                  / 100);
                tjShiftArray = new PdfTextArray();
                tjShiftArray.Add(new PdfNumber(tjShift));
            }
            if (cleanedText != null)
            {
                if (newLineShowText)
                {
                    // char spacing and word spacing are set via writeNotAppliedTextStateParams() method
                    canvas.NewlineText();
                }
                if (removedTextShift != null)
                {
                    tjShiftArray.AddAll(cleanedText);
                    cleanedText = tjShiftArray;
                }
                canvas.ShowText(cleanedText);
            }
            else
            {
                if (removedTextShift != null)
                {
                    canvas.ShowText(tjShiftArray);
                }
                PdfCleanUpProcessor.WriteOperands(canvas, operands);
            }
        }
示例#2
0
 public virtual float GetLeading()
 {
     return(gs.GetLeading());
 }