I have two pdf files and I want to compare those two pdf files and print the difference in messagebox.
So far I have this (but it is not working as I expect):
private void button1_Click(object sender, EventArgs e)
{
string str1 = this.textBox1.Text;
string str2 = this.textBox2.Text;
string comparison = str1.Replace(str2,"");
MessageBox.Show(comparison);
}
private void ParsePDF(string filePath)
{
string text = string.Empty;
PdfReader reader = new iTextSharp.text.pdf.PdfReader(filePath);
byte[] streamBytes = reader.GetPageContent(1);
PRTokeniser tokenizer = new PRTokeniser(streamBytes);
while (tokenizer.NextToken())
{
if (tokenizer.TokenType == PRTokeniser.TokType.STRING)
{
text += tokenizer.StringValue;
}
}
this.textBox1.Text = text.ToString();
this.textBox2.Text = text.ToString();
}
}
and just below I call that method: ParsePDF("C://Users//lf222aw//Desktop//file1.pdf");
my program works like this: Suppose i have one textbox with text "I love stackoverflow" and the other textbox "I stackoverflow" and my program prints this as a result: "I love stackoverflow" and what i want to print is "love" as a difference between two those files
Any idea?? Regards,