當前位置: 首頁>>代碼示例>>C#>>正文


C# TextRenderInfo.GetCharacterRenderInfos方法代碼示例

本文整理匯總了C#中iTextSharp.text.pdf.parser.TextRenderInfo.GetCharacterRenderInfos方法的典型用法代碼示例。如果您正苦於以下問題:C# TextRenderInfo.GetCharacterRenderInfos方法的具體用法?C# TextRenderInfo.GetCharacterRenderInfos怎麽用?C# TextRenderInfo.GetCharacterRenderInfos使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在iTextSharp.text.pdf.parser.TextRenderInfo的用法示例。


在下文中一共展示了TextRenderInfo.GetCharacterRenderInfos方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RenderText

            public void RenderText(TextRenderInfo renderInfo)
            {
                List<TextRenderInfo> subs = renderInfo.GetCharacterRenderInfos();
                TextRenderInfo previousCharInfo = subs[0];

                for (int i = 1; i < subs.Count; i++)
                {
                    TextRenderInfo charInfo = subs[i];
                    Vector previousEndPoint = previousCharInfo.GetBaseline().GetEndPoint();
                    Vector currentStartPoint = charInfo.GetBaseline().GetStartPoint();
                    AssertVectorsEqual(previousEndPoint, currentStartPoint, charInfo.GetText());
                    previousCharInfo = charInfo;
                }

            }
開發者ID:smartleos,項目名稱:itextsharp,代碼行數:15,代碼來源:TextRenderInfoTest.cs

示例2: RenderText

        //Automatically called for each chunk of text in the PDF
        public override void RenderText(TextRenderInfo renderInfo)
        {
            base.RenderText(renderInfo);

            //See if the current chunk contains the text
            var startPosition = System.Globalization.CultureInfo.CurrentCulture.CompareInfo.IndexOf(
                renderInfo.GetText(), this.TextToSearchFor, this.CompareOptions);

            //If not found bail
            if (startPosition < 0)
            {
                return;
            }

            if (renderInfo.PdfString.ToString() != this.TextToSearchFor)
            {
                return;
            }

            //Grab the individual characters
            var chars =
                renderInfo.GetCharacterRenderInfos().Skip(startPosition).Take(this.TextToSearchFor.Length).ToList();

            //Grab the first and last character
            var firstChar = chars.First();
            var lastChar = chars.Last();

            //Get the bounding box for the chunk of text
            var bottomLeft = firstChar.GetDescentLine().GetStartPoint();
            var topRight = lastChar.GetAscentLine().GetEndPoint();

            //Create a rectangle from it
            var rect = new iTextSharp.text.Rectangle(
                bottomLeft[Vector.I1],
                bottomLeft[Vector.I2],
                topRight[Vector.I1],
                topRight[Vector.I2]
                );

            //Add this to our main collection
            this.MyPoints.Add(new RectAndText(rect, this.TextToSearchFor));
        }
開發者ID:raviroyind,項目名稱:PdfHighlighter,代碼行數:43,代碼來源:PdfTextHighlighter.cs

示例3: RenderText

        public virtual void RenderText(TextRenderInfo renderInfo) {
            if (renderInfo.PdfString.ToUnicodeString().Length == 0) {
                return;
            }

            // if true, than clipping path was completely cleaned
            if (newClippingPath.IsEmpty()) {
                LineSegment baseline = renderInfo.GetUnscaledBaseline();
                chunks.Add(new PdfCleanUpContentChunk.Text(renderInfo.PdfString, baseline.GetStartPoint(), 
                    baseline.GetEndPoint(), false, strNumber));
            } else {
                foreach (TextRenderInfo ri in renderInfo.GetCharacterRenderInfos()) {
                    bool isAllowed = filter.AllowText(ri);
                    LineSegment baseline = ri.GetUnscaledBaseline();

                    chunks.Add(new PdfCleanUpContentChunk.Text(ri.PdfString, baseline.GetStartPoint(),
                        baseline.GetEndPoint(), isAllowed, strNumber));
                }
            }

            ++strNumber;
        }
開發者ID:Niladri24dutta,項目名稱:itextsharp,代碼行數:22,代碼來源:PdfCleanUpRenderListener.cs

示例4: RenderText

 public override void RenderText(TextRenderInfo renderInfo) {
     foreach (TextRenderInfo tri in renderInfo.GetCharacterRenderInfos())
         base.RenderText(tri);
 }
開發者ID:newlysoft,項目名稱:itextsharp,代碼行數:4,代碼來源:HighlightItemsTest.cs

示例5: RenderText

        public virtual void RenderText(TextRenderInfo renderInfo) {
            if (renderInfo.PdfString.ToUnicodeString().Length == 0) {
                return;
            }

            foreach (TextRenderInfo ri in renderInfo.GetCharacterRenderInfos()) {
                bool isAllowed = filter.AllowText(ri);
                LineSegment baseline = ri.GetUnscaledBaseline();

                chunks.Add(new PdfCleanUpContentChunk.Text(ri.PdfString, baseline.GetStartPoint(),
                    baseline.GetEndPoint(), isAllowed, strNumber));
            }

            ++strNumber;
        }
開發者ID:yu0410aries,項目名稱:itextsharp,代碼行數:15,代碼來源:PdfCleanUpRenderListener.cs


注:本文中的iTextSharp.text.pdf.parser.TextRenderInfo.GetCharacterRenderInfos方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。