title: With iTextSharp, how do I get the x,y coordinates of the image on a specific layer of a PDF
body: <p>I'm generating certificate documents for different clients. I have different pdf documents that I use as a template and fill in the relevant info for the client. </p>
  
  <p>I also add in a logo specific to the client. I currently remove a layer that contains only the logo in my template pdf and add in the new logo. </p>
  
  <pre><code>//Apply Logos
          if (_CertificateLogo != "" || _ExpiryDate.HasValue)
          { 
              foreach (string key in layers.Keys.ToList())
              {  
                  if (key.ToLower().Equals("logo") &amp;&amp; _CertificateLogo != "")
                  {
                      PdfLayer logoLayer = (PdfLayer)layers[key];
                      logoLayer.On = false;
                      logoLayer.OnPanel = false;
                      logoLayer.View = false;
                  }
                  else if (key.ToLower().Equals("expiry") &amp;&amp; !(_ExpiryDate.HasValue))
                  {
                      PdfLayer expirylayer = (PdfLayer)layers[key];
                      expirylayer.On = false;
                      expirylayer.OnPanel = false;
                      expirylayer.View = false;
                  }
              }
  
              try
              {
                  string certLogoPath = HttpContext.Current.Server.MapPath("\\Player\\" + _CertificateLogo);
                  Image imgCertLogo = Image.GetInstance(File.ReadAllBytes(certLogoPath));
                  Rectangle pageSize = reader.GetPageSizeWithRotation(1);
                  PdfSize = pageSize;
  
                  imgCertLogo.SetAbsolutePosition(
                      (imgCertLogo.ScaledWidth / 2) + 10,
                      pageSize.Height - 60 - imgCertLogo.ScaledHeight
                      );
  
                  pdfContentByte.AddImage(imgCertLogo, true);
  
              }
              catch
              { 
                  //No branded certificate for you!
              }
          }
  </code></pre>
  
  <p>The problem is different certificate templates will have the logo positioned differently. </p>
  
  <p>Is there a way I can get the absolute position of the current image on the logo layer, and use that to set the position of the new image I am adding in?</p>