public void RenderText(iTextSharp.text.pdf.parser.TextRenderInfo renderInfo)
 {
     foreach (TextRenderInfo info in renderInfo.GetCharacterRenderInfos())
     {
         this.textextractionstrategy.RenderText(info);
     }
 }
Exemple #2
0
 public virtual void RenderText(TextRenderInfo renderInfo)
 {
     if (textRectangle == null)
     {
         textRectangle = renderInfo.GetDescentLine().GetBoundingRectange();
     }
     else
     {
         textRectangle.Add(renderInfo.GetDescentLine().GetBoundingRectange());
     }
     textRectangle.Add(renderInfo.GetAscentLine().GetBoundingRectange());
 }
        //Automatically called for each chunk of text in the PDF
        public override void RenderText(iTextSharp.text.pdf.parser.TextRenderInfo renderInfo)
        {
            base.RenderText(renderInfo);

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

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

            //Add this to our main collection
            this.myPoints.Add(new RectAndText(rect, renderInfo.GetText()));
        }
    //This is called whenever a run of text is encountered
    public void RenderText(iTextSharp.text.pdf.parser.TextRenderInfo renderInfo)
    {
        //This code assumes that if the baseline changes then we're on a newline
        Vector curBaseline = renderInfo.GetBaseline().GetStartPoint();

        //See if the baseline has changed
        if ((this.lastBaseLine != null) && (curBaseline[Vector.I2] != lastBaseLine[Vector.I2]))
        {
            //See if we have text and not just whitespace
            if ((!String.IsNullOrWhiteSpace(this.result.ToString())))
            {
                //Mark the previous line as done by adding it to our buffers
                this.baselines.Add(this.lastBaseLine[Vector.I2]);
                this.strings.Add(this.result.ToString());
            }
            //Reset our "line" buffer
            this.result.Clear();
        }
        //Append the current text to our line buffer
        this.result.Append(renderInfo.GetText());
        //Reset the last used line
        this.lastBaseLine = curBaseline;
    }
 public void RenderText(iTextSharp.text.pdf.parser.TextRenderInfo renderInfo)
 {
 }