Compare 2 pdfs and need to know differences
Hi Folks,
I am building an application that would compare two pdfs and show me differences:
Here I am confused how to store data and show it to user
private bool FileCompare(string file1, string file2)
{
int file1byte;
int file2byte;
FileStream fs1;
FileStream fs2;
if (file1 == file2)
{
return true;
}
fs1 = new FileStream(file1, FileMode.Open);
fs2 = new FileStream(file2, FileMode.Open);
if (fs1.Length != fs2.Length)
{
fs1.Close();
fs2.Close();
return false;
}
do
{
file1byte = fs1.ReadByte();
file2byte = fs2.ReadByte();
}
while ((file1byte == file2byte) && (file1byte != -1));
fs1.Close();
fs2.Close();
return ((file1byte - file2byte) == 0);
}
private void PdfCompare_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
if (FileCompare(this.textBox1.Text, this.textBox2.Text))
{
MessageBox.Show("Files are equal.");
}
else
{
MessageBox.Show("Files are not equal.");
}
}
}
Can you please help me on this?
Thank you!!