Goran Bibic

Goran Bibic

  • 458
  • 2.9k
  • 180.4k

Select image from db to pdf document C#

Nov 5 2019 9:42 AM
I try this Itext sharp and work
 
  1. iTextSharp.text.Image logo = iTextSharp.text.Image.GetInstance("C:\\Program files\\BSS\\memorandum.jpg");  
  2.   
  3. logo.ScaleAbsolute(550, 110);  
  4. logo.SetAbsolutePosition(25, 715);  
  5. pdfDoc.Add(logo); 
 I need from db to document

And When try solution down
 
  1. string Memorandum = "";  
  2.            using (SqlConnection openCon14 = new SqlConnection(Con))  
  3.            {  
  4.                SqlDataReader reader14;  
  5.                SqlCommand cmd14 = new SqlCommand();  
  6.                cmd14.CommandText = "select memorandum from podaci_o_korisniku";  
  7.                cmd14.Connection = openCon14;  
  8.                openCon14.Open();  
  9.                reader14 = cmd14.ExecuteReader();  
  10.                while (reader14.Read())  
  11.                {  
  12.                   Memorandum = reader14[0].ToString();  
  13.                }  
  14.                openCon14.Close();  
  15.            } 
 And have error
 
  1. +       $exception  {"Could not find file 'C:\\Users\\Bibic Goran\\source\\repos\\BSS\\BSS\\bin\\Debug\\System.Byte[]'."}   System.Net.WebException 
 System byte missing?
 

Answers (1)