title: How to absolute position the image in existing pdf using itextsharp
body: <p>Here is the code I have so far:</p>
  
  <pre><code>Imports iTextSharp.text
  Imports iTextSharp.text.pdf
  Imports System.IO
  
  Module Module1
  
      Sub Main()
          AddjImage("C:\test.png", "c:\pdfTemplate.pdf", "C:\output.pdf")
      End Sub
      Private Function AddjImage(ByVal strImageFileName As String, ByVal pdfTemplateFile As String, ByVal outputPdf As String) As Boolean
          Try
              Dim iPdfReader As PdfReader = New PdfReader(pdfTemplateFile)
              Dim iPdfStamper As PdfStamper = New PdfStamper(iPdfReader, New FileStream(outputPdf, FileMode.Create))
              Dim imgjImage As iTextSharp.text.Image
              Dim bytContent As PdfContentByte
              'Insert Image
              imgjImage = iTextSharp.text.Image.GetInstance(strImageFileName)
              imgjImage.Alignment = iTextSharp.text.Image.ALIGN_TOP
              imgjImage.ScalePercent(78)
              imgjImage.SetAbsolutePosition(445, 0)
              bytContent = iPdfStamper.GetOverContent(1)
              bytContent.AddImage(imgjImage)
              iPdfStamper.FormFlattening = True
              iPdfStamper.Close()
              Return True
          Catch ex As Exception
              Return False
          End Try
      End Function    
  End Module
  </code></pre>
  
  <p>The pdf is in landscape layout. The page size is A4. I am trying to insert the image on right side of the pdf page. I want to align the image on x=445 and y=0 position.</p>
  
  <p>I have couple of images with two sizes. They are:
  image 1 with width=500px; height=910px;
  image 2 with width=500px; height=400px;</p>
  
  <p>The problem is, both the images are aligned to bottom instead of top. because of that the top portion of image 1 is cut off.</p>