Click here to Skip to main content
15,884,849 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,
I m facing a problem in adobe reader in c#
i have 2 projects and i have coded same in both but in one the pdf is opening and in other pdg doesn't open
So please help me
Posted
Comments
agent_kruger 27-May-14 1:48am    
sir, please post the code of both project without it we cannot help

C#
strQuery = "select * from test_drawing where s_no=3";
           objCmd = new OleDbCommand(strQuery, objConn);
           dr = objCmd.ExecuteReader();
           if (dr.Read())
           {
               write = (byte[])dr[1];
           }
           dr.Close();
           //if (!File.Exists(path + "\\drawing.pdf"))
           //{
           //    File.Create(path + "\\drawing.pdf");
           //    filename = path + "\\drawing.pdf";
           //}
           //else
           //{
           //    File.Delete(path + "\\drawing.pdf");
           //    File.Create(path + "\\drawing.pdf");
           //    filename = path + "drawing.pdf";
           //}
           filename = path + "drawing.pdf";
           using (FileStream
          fileStream = new FileStream(filename, FileMode.Create))
           {
               // Write the data to the file, byte by byte.
               for (int i = 0; i < write.Length; i++)
               {
                   fileStream.WriteByte(write[i]);
               }

               // Set the stream position to the beginning of the file.
               fileStream.Seek(0, SeekOrigin.Begin);

               // Read and verify the data.
               for (int i = 0; i < fileStream.Length; i++)
               {
                   if (write[i] != fileStream.ReadByte())
                   {
                       Console.WriteLine("Error writing data.");
                       return;
                   }
               }
               fileStream.Flush();
               fileStream.Close();
               axAcroPDF1.LoadFile(filename);
           }
 
Share this answer
 
I was using the was as imdparent
 
Share this answer
 
Comments
Richard MacCutchan 28-May-14 7:13am    
Please do not post your comments in Solutions, it means people think your problem is solved. Use the Improve question" link above, and edit your original post.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900