I have to print and preview the pdf's separately in 2 different functionalities
i.e without using the
System.Diagnostics.Process.Start(@filePath); code . As this code is not acceptable by our security platform scan.kindly help..
private void PreviewFile(byte[] blobData, string fileName)
{
if (blobData != null)
string filePath;
PDFPreviewHandler pdf = new PDFPreviewHandler();
string tempDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "Template");
if (!Directory.Exists(tempDirectory))
Directory.CreateDirectory(tempDirectory);
filePath = Path.Combine(tempDirectory, fileName);
try
FileStream fileStream = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite);
bool isfile = false;
fileStream.Write(blobData, 0, blobData.GetUpperBound(0));
fileStream.Flush();
fileStream.Close();
fileStream.Dispose();
//Displaying the file
if (File.Exists(@filePath))
isfile = true;
}
if (isfile && File.Exists(@filePath))
System.IO.File.OpenRead(filePath);
wb1.Navigate(@filePath);
// byte[] byteArray = System.IO.File.ReadAllBytes(@filePath);
// System.Diagnostics.Process.Start(@filePath);
System.Diagnostics.Process.Start(@filePath);