Can any one help me,
I am creating PDF File and it is created successfully but file is not opened in pdf reader and code is below and if i am reading the content of file it is printing.
using System;
using System.IO;
class DemoStreaming
{
static void Main()
{
string path=@"D:\Stream\MyFile.pdf";
FileStream fs=File.Create (path );
fs.Close();
StreamWriter sw = File.CreateText(path);
sw.WriteLine("Hidaya Trust Pakistan");
sw.WriteLine("Hidaya Trust USA");
sw.WriteLine("Hidaya Trust India");
sw.Close();
StreamReader reader = File.OpenText(path);
while (reader.Peek() > 0)
Console.WriteLine(reader.ReadLine());
Console.ReadKey();
}
}

Vilas GitePosted Jul 9, 2011, 10:09 AM
same exception was occurred...I thought its version problem but, i open it in Adobe Reader version <10. But, same error was there...
Suthish NairPosted Jul 9, 2011, 9:24 AM
Vilas GitePosted Jul 9, 2011, 8:02 AM
I had test your code.. and create doc and xls file but not pdf, there some error like
"Adobe Reader could not open 'MyFile.pdf' because it is either not a supported
file type or because the file has been damaged (for example, it was sent as an
email attachment and wasn't correctly decoded)."
just refer our recommended article...
http://www.c-sharpcorner.com/UploadFile/f2e803/6046/
---------------------------------------------------------------------------------------------------If this reply hepls your post…then "MARK AS ANSWER"!
Jiteendra SampathiraoPosted Jul 9, 2011, 7:52 AM
Source: Knowledge Transfer
I hope it works......