title: How to Insert Image (byte) into pdf (byte) using ItextSharp
body: <p>I have a pdf(byte) stored in database table and I have also stored image(byte) in database table.</p>
  
  <p>Now I want to read pdf file from database and insert image (byte) into pdf file and want to save new pdf (byte) into new table. 
  It gives error as "The Document has no page."
  I have used below code:</p>
  
  <pre><code> string fileName = "~/AuthDoc/" + Convert.ToString(consentMain.AppointmentId) +".pdf";                              
              string newFile = System.Web.Hosting.HostingEnvironment.MapPath(fileName);
              PdfReader reader = new PdfReader(consentDoc); // get pdf byte from datbase
              Rectangle size = reader.GetPageSizeWithRotation(1);
              Document document = new Document(size);
              // open the writer
              FileStream fs = new FileStream(newFile, FileMode.Create, FileAccess.Write);
              PdfWriter writer = PdfWriter.GetInstance(document, fs);
              document.Open();
  
  
  
              // PdfReader reader = new PdfReader(consentDoc);
            //   FileStream fs = new FileStream(newFile, FileMode.Create);
              var stamper = new PdfStamper(reader, fs);
              var pdfContentByte = stamper.GetOverContent(1);
              iTextSharp.text.Image PatientSign = iTextSharp.text.Image.GetInstance(consentMain.PatientSign); // image from database
              PatientSign.SetAbsolutePosition(100, 100);
              pdfContentByte.AddImage(PatientSign);
  
              document.Close();
              fs.Close();
              writer.Close();
              reader.Close();
              byte[] bytes = System.IO.File.ReadAllBytes(newFile);
              return bytes;
  </code></pre>