I'm creating a PDF, and I add an image to it.
The image is 256x256 pixels, there's nothing special about it.
I set its position by
nImg.SetAbsolutePosition(30, 30)
However, the image seems to be placed at the bottom of the page.
The PDF looks like this:
I expected it to be placed on the top left corner when I call SetAbsolutePosition(30, 30).
What might be going on here?
This is the full code:
Dim nFs As System.IO.FileStream = New FileStream(sThis, FileMode.Create)
Dim nDocument As Document = New Document(PageSize.A4, 25, 25, 25, 25)
Dim nWriter As PdfWriter = PdfWriter.GetInstance(nDocument, nFs)
nDocument.Open()
Dim nCb As PdfContentByte = nWriter.DirectContent
Dim nImg As iTextSharp.text.Image = iTextSharp.text.Image.GetInstance("d:\myimage.png")
nImg.SetAbsolutePosition(30, 30)
nCb.AddImage(nImg)
nDocument.Close()
nWriter.Close()
nFs.Close()