I am trying to set an image field on a fillable PDF form with an image but
I am not able to get it to work.
I found this code but it does not work with iText 5.x
float[] photograph = form.getFieldPositions(fieldName);
Rectangle rect = new Rectangle(photograph[1]
, photograph[2]
, photograph[3]
, photograph[4]);
Image img = Image.getInstance(imageName);
img.scaleToFit(rect.getWidth(), rect.getHeight());
img.setAbsolutePosition(
photograph[1] + (rect.getWidth() - img
.getScaledWidth()) / 2
,photograph[2] + (rect.getHeight() - img
.getScaledHeight()) / 2);
PdfContentByte cb = stamper.getOverContent((int
)photograph[0]);
cb.addImage(img);
Is there a page in the book or example on the web site?
I have looked but I am not seeing it.
Can someone please assist?
Michael Marcavage ------------------------------------------------------------------------------
Keep yourself connected to Go Parallel:
DESIGN Expert tips on starting your parallel project right.
http://goparallel.sourceforge.net/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php