As far as I know, you cannot technically set the standard PDF field as an image (although you can do it using XFA).
However, a workaround is to simply create a standard iTextSharp image and scale it to the size of the form field and place it where that field is.
Below is a complete working C # 2010 WinForms application targeting iTextSharp 5.1.1.0, which shows how to do this. It starts by creating a very simple PDF file with one form field called "firstName". The second part of the program then obtains the position and dimensions of this field and places the image scaled accordingly. See comments in the code for more details.
using System; using System.ComponentModel; using System.Text; using System.Windows.Forms; using System.IO; using iTextSharp.text; using iTextSharp.text.pdf; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { string baseFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "StartFile.pdf"); string secondFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "SecondFile.pdf"); string TestImage = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Test.jpg");
source share