//public static int GetNoOfPagesPDF(string FileName)
//{
// int result = 0;
// FileStream fs = new FileStream(FileName, FileMode.Open, FileAccess.Read);
// StreamReader r = new StreamReader(fs);
// string pdfText = r.ReadToEnd();
// System.Text.RegularExpressions.Regex regx = new Regex(@"/Type\s*/Page[^s]");
// System.Text.RegularExpressions.MatchCollection matches = regx.Matches(pdfText);
// result = matches.Count;
// return result;
//}
public void merge(string sFile1, string sFile2)
{
FileStream fs1 = null;
FileStream fs2 = null;
try
{
fs1 = File.Open(sFile1, FileMode.Append);
fs2 = File.Open(sFile2, FileMode.Open);
byte[] fs2Content = new byte[fs2.Length];
fs2.Read(fs2Content, 0, (int)fs2.Length);
fs1.Write(fs2Content, 0, (int)fs2.Length);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + " : " + ex.StackTrace);
}
finally
{
fs1.Close();
fs2.Close();
}
}
Comments
Post a Comment