//  process all pages
        public void Process(List <LineDataOfPage> data)
        {
            //  initializing.
            pageData    = data;
            article     = InitializeProcessingArticle();
            tempArticle = "";
            left        = InitializeProcessingColumn();
            right       = InitializeProcessingColumn();


            _logger.LogInformation($"======================= Script Running! ====================");
            int pageNumber = 1;

            foreach (var pg in pageData)
            {
                _logger.LogInformation($"======================= Page {pageNumber} Processing ====================");
                page = pg;

                ProcessPage();

                pageNumber++;
            }
            left  = ProcessColumn(left);
            right = ProcessColumn(right);
        }
        //process current line;
        private void ProcessLine()
        {
            // ignoring all non-article lines if article was not set yet.
            if (string.IsNullOrEmpty(article.Article))
            {
                return;
            }

            //  check whether current line is for article extension or not.
            if (CheckExtendArticleLine())
            {
                left              = ProcessColumn(left);
                right             = ProcessColumn(right);
                article.Extension = GetEntireLineText();

                article = daService.AddArticleExtend(article);

                _logger.LogInformation($">>Extend Article Added. Extend Article : {article.Extension}, Parent Article : {article.Article}");

                return;
            }



            // check whether this line is for first column or second column by line's X position.
            if (line.Box.X < 100)
            {
                left = LineDataProcess(left);
            }
            else
            {
                right = LineDataProcess(right);
            }
        }
        // process current page.
        private void ProcessPage()
        {
            foreach (var ln in page.LineList)
            {
                line = ln;
                //  check whether current line is for article or not.
                if (CheckArticleLine())
                {
                    // if current line is article line, then should check it has multi-lines or not. so save it to tempArticle temperarilly.
                    if (tempArticle == "")
                    {
                        //  should process columns when new article start.
                        left  = ProcessColumn(left);
                        right = ProcessColumn(right);
                        // save article name to tempArticle.
                        tempArticle = GetEntireLineText();
                    }
                    else
                    {
                        // In case of previous line is article line. so current article is surely multi-line at this point.
                        tempArticle += " " + GetEntireLineText();
                    }
                }
                else
                {
                    if (tempArticle != "")
                    {
                        // In case of article lines were ended at previous line. so should process article.
                        ProcessArticle();
                        tempArticle = "";
                    }

                    //  process non-article line.
                    ProcessLine();
                }
            }
        }
        private ProcessingColumn ProcessColumn(ProcessingColumn column)
        {
            try
            {
                if (column.IsValueEmpty)
                {
                    return(column);
                }
                if (column.Value != "")
                {
                    column.Value = column.Value.Trim();
                    column.Values.Add(column.Value);
                    column.Value = "";
                }
                int associationId = daService.AddAssociation(article.Id, column.Type);
                foreach (var v in column.Values)
                {
                    if (v.IndexOf('(') > 0)    // In case of there's some modifier or continued for association value
                    {
                        string modifier = v.Substring(v.IndexOf('(') + 1, v.IndexOf(')') - v.IndexOf('(') - 1);
                        string val      = v.Substring(0, v.IndexOf('(') - 1).Trim();
                        if (article.Extension == "") // no extension
                        {
                            _logger.LogInformation($">>>>>> Association Value Added. Value : {val}, Type : {column.Type}, Article : {article.Article}");
                        }
                        else
                        {
                            // In case of article is extension.
                            _logger.LogInformation($">>>>>> Association Value Added. Value : {val}, Type : {column.Type}, Extend Article : {article.Extension}, Parent Article : {article.Article}");
                        }
                        int valId = daService.AddAssociationValue(associationId, val);
                        foreach (var item in modifier.Split(','))
                        {
                            if (article.Extension == "") // no extension
                            {
                                _logger.LogInformation($">>>>>> Association Value Modifier Added. Modifier : {item.Trim()}, Value : {val}, Type : {column.Type},  Article : {article.Article}");
                            }
                            else
                            {
                                // In case of article is extension.
                                _logger.LogInformation($">>>>>> Association Value Modifier Added. Modifier : {item.Trim()}, Value : {val}, Type : {column.Type}, Extend Article : {article.Extension}, Parent Article : {article.Article}");
                            }
                            daService.AddAssociationValueModifier(valId, item.Trim());
                        }
                    }
                    else
                    {
                        if (article.Extension == "") // no extension
                        {
                            _logger.LogInformation($">>>>>> Association Value Added. Value : {v.Trim()}, Type : {column.Type}, Article : {article.Article}");
                        }
                        else
                        {
                            _logger.LogInformation($">>>>>> Association Value Added. Value : {v.Trim()}, Type : {column.Type}, Extend Article : {article.Extension}, Parent Article : {article.Article}");
                        }
                        daService.AddAssociationValue(associationId, v.Trim());
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
            }

            return(InitializeProcessingColumn());
        }
        private ProcessingColumn LineDataProcess(ProcessingColumn column)
        {
            foreach (var word in line.WordList)
            {
                switch (word.Font)
                {
                case Italic:
                {
                    if (!column.IsValueEmpty)
                    {
                        if (column.IsModifier == true || word.Text.IndexOf('(') >= 0)           // In case of association value modifier
                        {
                            // If find '(' character, then it will be modifier.
                            column.Value += (column.Value == "" ? "" : " ") + word.Text;

                            column.IsModifier = true;

                            if (column.Value.IndexOf(')') >= 0)
                            {
                                // If find ')' character, then modifier will be ended.
                                column.IsModifier = false;
                            }
                            if (column.IsModifier == false)
                            {
                                // If find ',' character, then association value is ended. so add value.
                                if (column.Value[column.Value.Length - 1] == ',')
                                {
                                    column.Values.Add(column.Value.Substring(0, column.Value.Length - 1));
                                    column.Value = "";
                                }
                            }
                            break;
                        }
                        // In case of new association type. should process all association values for original type.
                        column = ProcessColumn(column);

                        column.Type = word.Text;
                        break;
                    }

                    column.Type += " " + word.Text;           // In case of continueing type field.

                    break;
                }

                case Regular:
                {
                    if (column.Type == "")          // In case of association value without assocciation type. this is buggy.
                    {
                        _logger.LogError($"--------------Error is occurred : association value setting without association type. value : {word.Text}");
                        break;
                    }
                    if (column.IsValueEmpty)        // In case of type field end and start value field.
                    {
                        if (column.Type[column.Type.Length - 1] == ':')
                        {
                            column.Type = column.Type.Substring(0, column.Type.Length - 1);
                            column.Type = column.Type.Trim();
                            _logger.LogInformation($">>>> Association Type Added. Type : {column.Type},  Article : {article.Article}");
                        }
                        else
                        {
                            _logger.LogError($"--------------Error is occurred : wrong association type. type : {word.Text}");
                        }
                    }

                    // In case of association value
                    column.Value += (column.Value == "" ? "" : " ") + word.Text;
                    if (column.Value.IndexOf('(') >= 0)
                    {
                        column.IsModifier = true;
                    }
                    if (column.Value.IndexOf(')') >= 0)
                    {
                        column.IsModifier = false;
                    }
                    if (column.IsModifier == false)
                    {
                        if (column.Value[column.Value.Length - 1] == ',')
                        {
                            column.Values.Add(column.Value.Substring(0, column.Value.Length - 1));
                            column.Value = "";
                        }
                    }
                    break;
                }
                }
            }
            return(column);
        }