예제 #1
0
        public void Finish()
        {
            chars = chars.OrderBy((TextChar a) => a.x1).ToList();
            var nchars = new List <TextChar> ();

            words = new List <TextWord> ();
            TextWord word = null;

            foreach (TextChar c in chars)
            {
                if (word == null || word.AddChar(c) == false)
                {
                    if (word != null)
                    {
                        TextChar c2 = new TextChar();

                        c2.x1         = c.x1;
                        c2.y1         = c.y1;
                        c2.x2         = c.x2;
                        c2.y2         = c.y2;
                        c2.fontFamily = c.fontFamily;
                        c2.fontSize   = c.fontSize;

                        nchars.Add(c2);
                    }

                    word = new TextWord();
                    words.Add(word);
                    word.AddChar(c);
                }

                nchars.Add(c);
            }

            chars = nchars;

            this.x1   = words[0].x1;
            this.x2   = words[words.Count - 1].x2;
            this.text = null;

            foreach (TextWord w in words)
            {
                text = text == null ? w.text : (text + " " + w.text);
                w.Finish(this);
            }

            if (this.text.Length != this.chars.Count)
            {
                throw new Exception("Error while creating lines from PDF.");
            }
        }
예제 #2
0
 public void UpdateRect(TextWord word)
 {
     y1 = word.y1;
     y2 = word.y2;
 }