public BoxName(int iux, int iuy, int iw, int ih, string sBoxDescriptor)
this.BoxDescriptor = sBoxDescriptor;
this.ActualValue = ExtractText(this._ux, this._uy, this._w, this._h);
public string BoxDescriptor { get; private set; }
public string CoordsString { get { return this._ux + "," + this._uy + "," + this._w + "," + this._h; } }
public int[] CoordsInt { get { return new[] {this._ux, this._uy, this._w, this._h}; } }
public string ActualValue { get; private set; }
private static string ExtractText(int iux, int iuy, int iw, int ih)
string _path = System.IO.Path.Combine(@"C:\Automation_EBS\PrintManager_Automation\PDF\", Program.Currentinvoice + ".pdf");
org.apache.pdfbox.pdmodel.PDDocument _doc = org.apache.pdfbox.pdmodel.PDDocument.load(_path);
org.apache.pdfbox.util.PDFTextStripperByArea _stripper =
new org.apache.pdfbox.util.PDFTextStripperByArea();
_stripper.addRegion("testRegion", new java.awt.Rectangle(iux, iuy, iw, ih));
_stripper.extractRegions((org.apache.pdfbox.pdmodel.PDPage) _doc.getDocumentCatalog().getAllPages().get(0));
string _text = _stripper.getTextForRegion("testRegion");
private System.Collections.Generic.List<BoxName> _patient_data_pdf =
new System.Collections.Generic.List<BoxName>();
this._patient_data_pdf.Add(new BoxName(393, 14, 54, 12, "Patient Invoice#"));
this._patient_data_pdf.Add(new BoxName(306, 61, 207, 12, "Patient Address"));
this._patient_data_pdf.Add(new BoxName(234, 72, 93, 12, "Patient City"));
this._patient_data_pdf.Add(new BoxName(471, 72, 21, 13, "Patient State"));
this._patient_data_pdf.Add(new BoxName(500, 72, 44, 14, "Patient Zip"));
this._patient_data_pdf.Add(new BoxName(486, 97, 25, 12, "Patient Accident State"));
this._patient_data_pdf.Add(new BoxName(90, 61, 88, 11, "Patient SSN/LastName"));
this._patient_data_pdf.Add(new BoxName(18, 73, 120, 13, "Patient First/ Last, First Name"));
this._patient_data_pdf.Add(new BoxName(10, 162, 301, 9, "Carrier Name"));
this._patient_data_pdf.Add(new BoxName(11, 171, 241, 10, "Carrier Address"));
this._patient_data_pdf.Add(new BoxName(11, 180, 132, 12, "Carrier CityStateZip"));
this._patient_data_pdf.Add(new BoxName(105, 732, 80, 11, "Normal Charge"));
this._patient_data_pdf.Add(new BoxName(115, 752, 65, 11, "Savings"));
this._patient_data_pdf.Add(new BoxName(459, 482, 54, 10, "Total Amount"));
public string GetActual(string descriptor)
var _box = System.Linq.Enumerable.FirstOrDefault(this._patient_data_pdf,
d => d.BoxDescriptor.Equals(descriptor));
string _actualvalue = _box.ActualValue;
string _actualvalue = "No Value";
public int[] GetCoords(string descriptor)
if (descriptor == null) throw new System.ArgumentNullException("descriptor");
var _box = System.Linq.Enumerable.FirstOrDefault(this._patient_data_pdf,
d => d.BoxDescriptor.Equals(descriptor));
int[] _coords = _box.CoordsInt;
public class UB04ItemPDFData
private readonly System.Collections.Generic.List<BoxName> _ub04_item_list1_pdf =
new System.Collections.Generic.List<BoxName>();
var _patientDbData = new UB04PatientDBData();
this._ub04_item_list1_pdf.Add(new BoxName(45, 217, 181, 13, "Item 1 Description"));
this._ub04_item_list1_pdf.Add(new BoxName(223, 217, 109, 12, "Item 1 HCPCS"));
this._ub04_item_list1_pdf.Add(new BoxName(334, 217, 50, 13, "Item 1 Serv Date"));
this._ub04_item_list1_pdf.Add(new BoxName(441, 217, 73, 13, "Item 1 Total Charge"));
if (_patientDbData.GetItemCount() > 1)
this._ub04_item_list1_pdf.Add(new BoxName(45, 229, 181, 13, "Item 2 Description"));
this._ub04_item_list1_pdf.Add(new BoxName(223, 229, 109, 12, "Item 2 HCPCS"));
this._ub04_item_list1_pdf.Add(new BoxName(334, 229, 50, 13, "Item 2 Serv Date"));
this._ub04_item_list1_pdf.Add(new BoxName(441, 229, 73, 13, "Item 2 Total Charge"));
if (_patientDbData.GetItemCount() > 2)
this._ub04_item_list1_pdf.Add(new BoxName(45, 241, 181, 13, "Item 3 Description"));
this._ub04_item_list1_pdf.Add(new BoxName(223, 241, 109, 12, "Item 3 HCPCS"));
this._ub04_item_list1_pdf.Add(new BoxName(334, 241, 50, 13, "Item 3 Serv Date"));
this._ub04_item_list1_pdf.Add(new BoxName(441, 241, 73, 13, "Item 3 Total Charge"));
if (_patientDbData.GetItemCount() > 3)
this._ub04_item_list1_pdf.Add(new BoxName(45, 253, 181, 13, "Item 4 Description"));
this._ub04_item_list1_pdf.Add(new BoxName(223, 253, 109, 12, "Item 4 HCPCS"));
this._ub04_item_list1_pdf.Add(new BoxName(334, 253, 50, 13, "Item 4 Serv Date"));
this._ub04_item_list1_pdf.Add(new BoxName(441, 253, 73, 13, "Item 4 Total Charge"));
public string GetActual(string descriptor)
var _box = System.Linq.Enumerable.FirstOrDefault(this._ub04_item_list1_pdf,
d => d.BoxDescriptor.Equals(descriptor));
string _actualvalue = _box.ActualValue;
string _actualvalue = "No Value";
public int[] GetCoords(string descriptor)
var _box = System.Linq.Enumerable.FirstOrDefault(this._ub04_item_list1_pdf,
d => d.BoxDescriptor.Equals(descriptor));
int[] _coords = _box.CoordsInt;