It doesnt throw any error but it just wont put the image on pdf form. Can anyone figure out what am i missing here
_pdfDocument = System.IO.Path.GetTempPath() & "TICKET_INFO.pdf"
_pdfDocumentOutput = System.IO.Path.GetTempPath() & "TICKET_INFO_OUTPUT.pdf"
SaveFromResources(_pdfDocument, My.Resources.template)
Using reader As New PdfReader(_pdfDocument)
Using stamper As New PdfStamper(reader, New IO.FileStream(_pdfDocumentOutput, IO.FileMode.Create))
Dim pdfForm As AcroFields = stamper.AcroFields
Dim test As System.Drawing.Image = Image.FromFile("123.jpg")
Dim logo As iTextSharp.text.Image = iTextSharp.text.Image.GetInstance(test, System.Drawing.Imaging.ImageFormat.Png)
Dim fieldPosition As AcroFields.FieldPosition = stamper.AcroFields.GetFieldPositions("Description")(0)
Dim imageField As New PushbuttonField(stamper.Writer, fieldPosition.position, "Description")
imageField.Image = logo
pdfForm.SetField("DateMade", "123")
pdfForm.ReplacePushbuttonField("Description", imageField.Field)
stamper.FormFlattening = True
End Using
End Using
Field DateMade is shown on output file but the image is not.
Edit: not possible to change tag to itextsharp from mobile app
According to : Stackoverflow - itext
The "official" way to do this, is to have a Button field as placeholder for the image, and to replace the "icon" of the button like this:
Edit: Field type is button and name is button2
Line changed to :
pdfForm.ReplacePushbuttonField("Button2", imageField.Field)
Still not showing the image.