Example #1
0
            public void TextTagBegin(GcPdfGraphics graphics, TextLayout textLayout, object tag)
            {
                int paragraphIndex;

                if (tag is int)
                {
                    paragraphIndex = (int)tag;
                }
                else
                {
                    paragraphIndex = -1;
                }

                StructElement paragraphElement;

                if (_currentParagraphIndex == paragraphIndex)
                {
                    paragraphElement = _currentparagraphElement;
                }
                else
                {
                    if (paragraphIndex >= 0)
                    {
                        paragraphElement = new StructElement("P");
                        ParentElement.Children.Add(paragraphElement);
                        _currentparagraphElement = paragraphElement;
                        _currentParagraphIndex   = paragraphIndex;
                    }
                    else
                    {
                        paragraphElement         = null;
                        _currentparagraphElement = paragraphElement;
                        _currentParagraphIndex   = paragraphIndex;
                    }
                }

                //
                if (paragraphElement != null)
                {
                    graphics.BeginMarkedContent(new TagMcid("P", _tagIndex));
                    McrContentItemLink mcil = new McrContentItemLink();
                    mcil.MCID = _tagIndex;
                    mcil.Page = Page;
                    paragraphElement.ContentItems.Add(mcil);
                    _tagIndex++;
                }
            }