title: Set the position of a text or an image in a pdf using itextsharp(C#/asp.net)
body: <p>I have added an image and some text in the pdf using <code>iTextSharp</code>.  However, I would like to position my image and text at specific position in the pdf. How do I do it?</p>
  
  <p>So far I tried,</p>
  
  <pre><code>img.SetAbsolutePosition(10000f,10000f);
  </code></pre>
  
  <p>But it is not working.
  Here is my complete code for generating the pdf,</p>
  
  <pre><code> private void generatepdf(byte[] byteImage)
    {
  
  
      //byte[] imageBytes = Convert.FromBase64String(base64);
  
      string text1= "Some Text";
      iTextSharp.text.Image image =   iTextSharp.text.Image.GetInstance(byteImage);
      image.ScalePercent(0.3f * 100);
      string logopath = Server.MapPath("~/images/img1.png");
      iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(logopath);
      img.SetAbsolutePosition(1000f,1000f);
      img.ScaleAbsolute(1500f, 0f);
      img.ScalePercent(0.5f*100);
      Paragraph ShopName = new Paragraph(text1);
      Paragraph id = "Some Text";
  
      using (System.IO.MemoryStream memoryStream = new System.IO.MemoryStream())
      {
          Document document = new Document(PageSize.A4, 188f, 88f, 5f, 10f);
          PdfWriter writer = PdfWriter.GetInstance(document, memoryStream);
          document.Open();
          document.Add(img);
          document.Add(ShopName);
          document.Add(image);
          document.Add(id);
          document.Close();
          byte[] bytes = memoryStream.ToArray();
          memoryStream.Close();
  
          Response.Clear();
          Response.ContentType = "application/pdf";
          Response.AddHeader("Content-Disposition", "attachment; filename=QRCode.pdf");
          Response.ContentType = "application/pdf";
          Response.Buffer = true;
          Response.Cache.SetCacheability(HttpCacheability.NoCache);
          Response.BinaryWrite(bytes);
          Response.End();
      }
  
   }
  </code></pre>