List <string> getPdfTextLines() { if (ActualRectangle == null) { return(null); } RectangleF ar = (RectangleF)ActualRectangle; TextAutoInsertSpace textAutoInsertSpace = ActualField.TextAutoInsertSpace != null ? ActualField.TextAutoInsertSpace : page.PageCollection.ActiveTemplate.TextAutoInsertSpace; if (ActualField.ColumnOfTable == null) { return(Pdf.GetTextLinesSurroundedByRectangle(page.PdfCharBoxs, ar, textAutoInsertSpace)); } List <string> ls = new List <string>(); List <Pdf.CharBox> cbs = (List <Pdf.CharBox>)TableFieldActualInfo.GetValue(Template.Field.Types.PdfCharBoxs); foreach (Line <Pdf.CharBox> l in GetLines(cbs, textAutoInsertSpace, null)) { StringBuilder sb = new StringBuilder(); foreach (Pdf.CharBox cb in l.CharBoxs) { if (cb.R.Left >= ar.Left && cb.R.Right <= ar.Right && cb.R.Top >= ar.Top && cb.R.Bottom <= ar.Bottom) { sb.Append(cb.Char); } } ls.Add(sb.ToString()); } return(ls); }
public List <CharBox> GetCharBoxes(string fieldName) { FieldActualInfo fai = getFoundFieldActualInfo(fieldName); if (!fai.Found) { return(null); } if (fai.ActualField is Template.Field.Pdf) { return((List <CharBox>)fai.GetValue(Template.Field.Types.PdfCharBoxs)); } return((List <CharBox>)fai.GetValue(Template.Field.Types.OcrCharBoxs)); }
public List <string> GetTextLines(string fieldName) { FieldActualInfo fai = getFoundFieldActualInfo(fieldName); if (!fai.Found) { return(null); } if (fai.ActualField is Template.Field.Pdf) { return((List <string>)fai.GetValue(Template.Field.Types.PdfTextLines)); } return((List <string>)fai.GetValue(Template.Field.Types.OcrTextLines)); }
List <string> getTextLinesAsTableColumn() { if (ActualRectangle == null) { return(null); } if (!TableFieldActualInfo.Found) { return(null); } RectangleF ar = (RectangleF)ActualRectangle; List <Pdf.CharBox> cbs = (List <Pdf.CharBox>)TableFieldActualInfo.GetValue(Template.Field.ValueTypes.PdfCharBoxs); List <string> ls = new List <string>(); foreach (Pdf.Line l in Pdf.GetLines(cbs, page.pageCollection.ActiveTemplate.TextAutoInsertSpace)) { StringBuilder sb = new StringBuilder(); foreach (Pdf.CharBox cb in l.CharBoxs) { if (cb.R.Left >= ar.Left && cb.R.Right <= ar.Right && cb.R.Top >= ar.Top && cb.R.Bottom <= ar.Bottom) { sb.Append(cb.Char); } } ls.Add(sb.ToString()); } return(ls); }
public List <Bitmap> GetOcrTextLineImages(string fieldName) { FieldActualInfo fai = getFoundFieldActualInfo(fieldName); if (!fai.Found) { return(null); } return((List <Bitmap>)fai.GetValue(Template.Field.Types.OcrTextLineImages)); }
public Bitmap GetImage(string fieldName) { FieldActualInfo fai = getFoundFieldActualInfo(fieldName); if (!fai.Found) { return(null); } return((Bitmap)fai.GetValue(Template.Field.Types.Image)); }
public object GetValue(string fieldName, Template.Field.ValueTypes?valueType = null) { FieldActualInfo fai = getFieldActualInfo(fieldName, true); if (!fai.Found) { return(null); } return(fai.GetValue(valueType == null ? fai.ActualField.DefaultValueType : (Template.Field.ValueTypes)valueType)); }
/// <summary> /// Tries field definitions of the given name in turn until some is found on the page. /// </summary> /// <param name="fieldName">field is referenced by name because there may be several field-definitions for the same name</param> /// <param name="actualField">actual field definition which was found on the page</param> /// <param name="type">if not set then DefaultValueType is used</param> /// <returns></returns> public object GetValue(string fieldName, out Template.Field actualField, Template.Field.Types?type = null) { FieldActualInfo fai = getFoundFieldActualInfo(fieldName); if (!fai.Found) { actualField = null; return(null); } actualField = fai.ActualField; return(fai.GetValue(type == null ? fai.ActualField.Type : (Template.Field.Types)type)); }