public LineInfo(TextRenderInfo info, string text) { this.Text = text; this.Font = info.GetFont().GetFontProgram().GetFontNames(); this.Object = info.GetPdfString(); this.Ascent = info.GetAscentLine(); this.Descent = info.GetDescentLine(); }
public virtual void EventOccurred(IEventData data, EventType type) { if (data is TextRenderInfo) { TextRenderInfo renderInfo = (TextRenderInfo)data; map.Put("String", renderInfo.GetPdfString().ToUnicodeString()); map.Put("FillOpacity", renderInfo.GetGraphicsState().GetFillOpacity()); map.Put("StrokeOpacity", renderInfo.GetGraphicsState().GetStrokeOpacity()); } }
public virtual void EventOccurred(IEventData data, EventType type) { switch (type) { case EventType.BEGIN_TEXT: { sb.Append("-------- BEGIN TEXT ---------").Append("\n"); sb.Append(END_EVENT_OCCURRENCE).Append("\n"); break; } case EventType.RENDER_TEXT: { sb.Append("-------- RENDER TEXT --------").Append("\n"); TextRenderInfo renderInfo = (TextRenderInfo)data; sb.Append("String: ").Append(renderInfo.GetPdfString().ToUnicodeString()).Append("\n"); sb.Append(END_EVENT_OCCURRENCE).Append("\n"); break; } case EventType.END_TEXT: { sb.Append("-------- END TEXT -----------").Append("\n"); sb.Append(END_EVENT_OCCURRENCE).Append("\n"); break; } case EventType.RENDER_IMAGE: { sb.Append("-------- RENDER IMAGE ---------").Append("\n"); ImageRenderInfo imageRenderInfo = (ImageRenderInfo)data; sb.Append("Image: ").Append(imageRenderInfo.GetImageResourceName()).Append("\n"); sb.Append(END_EVENT_OCCURRENCE).Append("\n"); break; } case EventType.RENDER_PATH: { sb.Append("-------- RENDER PATH --------").Append("\n"); PathRenderInfo pathRenderInfo = (PathRenderInfo)data; sb.Append("Operation type: ").Append(pathRenderInfo.GetOperation()).Append("\n"); sb.Append("Num of subpaths: ").Append(pathRenderInfo.GetPath().GetSubpaths().Count).Append("\n"); sb.Append(END_EVENT_OCCURRENCE).Append("\n"); break; } case EventType.CLIP_PATH_CHANGED: { sb.Append("-------- CLIPPING PATH ------").Append("\n"); ClippingPathInfo clippingPathRenderInfo = (ClippingPathInfo)data; sb.Append("Num of subpaths: ").Append(clippingPathRenderInfo.GetClippingPath().GetSubpaths().Count).Append ("\n"); sb.Append(END_EVENT_OCCURRENCE).Append("\n"); break; } } }
public void EventOccurred(IEventData data, EventType type) { switch (type) { case EventType.BEGIN_TEXT: { System.Console.Out.WriteLine("-------- BEGIN TEXT CALLED ---------"); System.Console.Out.WriteLine("------------------------------------"); break; } case EventType.RENDER_TEXT: { System.Console.Out.WriteLine("-------- RENDER TEXT CALLED --------"); TextRenderInfo renderInfo = (TextRenderInfo)data; System.Console.Out.WriteLine("String: " + renderInfo.GetPdfString()); System.Console.Out.WriteLine("------------------------------------"); break; } case EventType.END_TEXT: { System.Console.Out.WriteLine("-------- END TEXT CALLED -----------"); System.Console.Out.WriteLine("------------------------------------"); break; } case EventType.RENDER_IMAGE: { System.Console.Out.WriteLine("-------- RENDER IMAGE CALLED---------"); ImageRenderInfo renderInfo1 = (ImageRenderInfo)data; System.Console.Out.WriteLine("Image: " + renderInfo1.GetImage().GetPdfObject()); System.Console.Out.WriteLine("------------------------------------"); break; } case EventType.RENDER_PATH: { System.Console.Out.WriteLine("-------- RENDER PATH CALLED --------"); PathRenderInfo renderinfo2 = (PathRenderInfo)data; System.Console.Out.WriteLine("Path: " + renderinfo2.GetPath()); System.Console.Out.WriteLine("------------------------------------"); break; } case EventType.CLIP_PATH_CHANGED: { System.Console.Out.WriteLine("-------- CLIPPING PATH CALLED-------"); ClippingPathInfo renderinfo3 = (ClippingPathInfo)data; System.Console.Out.WriteLine("Clipping path: " + renderinfo3.GetClippingPath()); System.Console.Out.WriteLine("------------------------------------"); break; } } }
/// <summary>Filter a TextRenderInfo object</summary> /// <param name="text">the TextRenderInfo to be filtered</param> public virtual PdfCleanUpFilter.FilterResult <PdfArray> FilterText(TextRenderInfo text) { PdfTextArray textArray = new PdfTextArray(); if (IsTextNotToBeCleaned(text)) { return(new PdfCleanUpFilter.FilterResult <PdfArray>(false, new PdfArray(text.GetPdfString()))); } foreach (TextRenderInfo ri in text.GetCharacterRenderInfos()) { if (IsTextNotToBeCleaned(ri)) { textArray.Add(ri.GetPdfString()); } else { textArray.Add(new PdfNumber(-ri.GetUnscaledWidth() * 1000f / (text.GetFontSize() * text.GetHorizontalScaling () / 100))); } } return(new PdfCleanUpFilter.FilterResult <PdfArray>(true, textArray)); }