iTextSharp.text.html.simpleparser.HTMLWorker.Text C# (CSharp) Method

Text() public method

public Text ( String str ) : void
str String
return void
        public virtual void Text(String str) {
            if (skipText)
                return;
            String content = str;
            if (isPRE) {
                if (currentParagraph == null)
                    currentParagraph = FactoryProperties.CreateParagraph(cprops);
                currentParagraph.Add(factoryProperties.CreateChunk(content, cprops));
                return;
            }
            if (content.Trim().Length == 0 && content.IndexOf(' ') < 0) {
                return;
            }
            
            StringBuilder buf = new StringBuilder();
            int len = content.Length;
            char character;
            bool newline = false;
            for (int i = 0; i < len; i++) {
                switch (character = content[i]) {
                    case ' ':
                        if (!newline) {
                            buf.Append(character);
                        }
                        break;
                    case '\n':
                        if (i > 0) {
                            newline = true;
                            buf.Append(' ');
                        }
                        break;
                    case '\r':
                        break;
                    case '\t':
                        break;
                    default:
                        newline = false;
                        buf.Append(character);
                        break;
                }
            }
            if (currentParagraph == null)
                currentParagraph = FactoryProperties.CreateParagraph(cprops);
            currentParagraph.Add(factoryProperties.CreateChunk(buf.ToString(), cprops));
        }