private void button1_Click(object sender, EventArgs e)
{
Report_DatabaseEntities ef = new Report_DatabaseEntities();
OpenFileDialog ofd = new OpenFileDialog();
string filePath;
ofd.Filter = "PDF Files(*.pdf)|*.PDF|ALL Files(*.*)|*.*";
if (ofd.ShowDialog() == DialogResult.OK)
filePath = ofd.FileName.ToString();
PdfReader reader = new PdfReader(filePath);
string strtext = string.Empty;
try
List<Report_Class>test1 = new List<Report_Class>();
ITextExtractionStrategy its = new iTextSharp.text.pdf.parser.LocationTextExtractionStrategy();
for (int page = 1; page <= reader.NumberOfPages; page++)
String s = PdfTextExtractor.GetTextFromPage(reader, page, its);
s = Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.Default, Encoding.UTF8, Encoding.Default.GetBytes(s))); strtext = strtext + s;
string[] test = strtext.Split('\n');
foreach(var n in test)
{ test1.Add(new Report_Class()
record=n }); } } foreach(var sa in test1) { string test2 = sa.record; string[] ssize = test2.Split(null); } } catch (Exception ex) { MessageBox.Show(ex.Message); } reader.Close(); MessageBox.Show("File Has been UPLOAD"); } }
record=n
});
}
foreach(var sa in test1)
string test2 = sa.record;
string[] ssize = test2.Split(null);
catch (Exception ex)
MessageBox.Show(ex.Message);
reader.Close();
MessageBox.Show("File Has been UPLOAD"); } }