Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

PDF File Issue


  • Please log in to reply

#1
sreeni2219

sreeni2219

    New Member

  • Member
  • Pip
  • 1 posts
I have stored my PDF files in the database as binary code.
Now i want to retriee the the binay format file and want to display to my user.
But when ever i have tried the file is not visible. Why? Any help..
Your help highly appriciated!I have written below code..

Basically i want to show the report to the user, I like to store in memory rather physically storing the report in hard drive.
Or do we have any better way to display the report to my user from database (But constraint is File should show in PDF format only!)



string strString= "Select Image From ImageTable where ID=1"
SqlConnection connection = new SqlConnection(connectionstring);
connection.Open();
SqlDataAdapter da = new SqlDataAdapter(strSpName, connection);
da.SelectCommand.CommandType = CommandType.Text;

DataSet ds = new DataSet();

// Fill dataset
da.Fill(ds,"Image");

if (ds.Tables[0].Rows.Count > 0)

{

byte[] Myimage= new byte[0];
DataRow dr;
dr=ds.Tables["Image"].Rows[0];

Myimage = (byte[])dr["NoticeImage"];
int ArraySize = new int();
ArraySize = Myimage.GetUpperBound(0);

FileStream fs = new FileStream(@"C:\Temp\image.pdf", FileMode.OpenOrCreate, FileAccess.Write);
fs.Write(Myimage, 0,ArraySize);
fs.Flush();
fs.Close();
File.Open(@"C:\Temp\image.pdf", FileMode.Open);


}
  • 0

Advertisements


#2
darth_ash

darth_ash

    Member 1K

  • Member
  • PipPipPipPip
  • 1,382 posts
Hi sreeni2219,

PDF files are encoded in RSA with a 128-bit key, and only Adobe products can propely read, write or view it to it, since the format is registered to them and they have the 128-bit key. So, in your app. all your user will see is a bunch of binary code.

Crystal Reports is widely used for reports in the industry, also it comes built-in with Visual Studio.NET
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP