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();
}
}


Jiteendra SampathiraoRank #585 · 4.1K reputationPosted Jul 9, 2011, 3:52 AM EDT
Source: Knowledge Transfer
I hope it works......
Vilas GiteRank #951 · 2.1K reputationPosted Jul 9, 2011, 4:02 AM EDT
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"!
Suthish NairRank #92 · 22.8K reputationPosted Jul 9, 2011, 5:24 AM EDT
Vilas GiteRank #951 · 2.1K reputationPosted Jul 9, 2011, 6:09 AM EDT
same exception was occurred...I thought its version problem but, i open it in Adobe Reader version <10. But, same error was there...