title: how to change position of added image in pdf using iTextSharp
body: <p>I want to change the Image position to be in the top right of the pdf as a logo , this code make my image in the top left and some text wrote on it :</p>
  
  <pre><code>string oldFile = @"D:\Source pdf\Source.pdf";
          string newFile = @"D:\Result pdf\Result.pdf";
  
          string imagepath = @"D:\Source pdf\Myiamge.jpg";
          Console.WriteLine("iText Demo");
  
          PdfReader reader = new PdfReader(oldFile);
          Rectangle size = reader.GetPageSizeWithRotation(1);
          Document document = new Document(size);
  
          FileStream fs = new FileStream(newFile, FileMode.Create, FileAccess.Write);
          PdfWriter writer = PdfWriter.GetInstance(document, fs);
          document.Open();
  
          iTextSharp.text.Image instanceImg = iTextSharp.text.Image.GetInstance(imagepath);
          document.Add(instanceImg);
  
          PdfContentByte cb = writer.DirectContent;
          BaseFont bf = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
          cb.SetColorFill(BaseColor.DARK_GRAY);
          cb.SetFontAndSize(bf, 8);
  
  
          PdfImportedPage page = writer.GetImportedPage(reader, 1);
          cb.AddTemplate(page, 0, 0);
  
          document.Close();
          fs.Close();
          writer.Close();
          reader.Close(); 
  </code></pre>