I ran into the same issue a few weeks ago.

Simple text fields sized to the rectangle region of the image worked for me.

In the acroform class, get the field you want to add an image to. Then,
create a PdfContentByte and add the image.

Example:

    public void setFieldImage(String fieldName, String imageName) {
        try {
            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.width(), rect.height()); 
            img.setAbsolutePosition(
                photograph[1] + (rect.width() - img.scaledWidth()) / 2
              , photograph[2] + (rect.height() - img.scaledHeight()) / 2); 
            PdfContentByte cb = stamper.getOverContent((int)photograph[0]);
            cb.addImage(img);
        }
        catch(Exception e) {
            e.printStackTrace();
        }
    }


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Thursday, May 04, 2006 12:26 PM
To: [email protected]
Subject: Re: [iText-questions] Insert images into forms using PdfStamper?


> You already have fields in your original PDF, so the best way to solve
> this
> problem would be to add some extra fields (for instance some button
> fields)
> as placeholders for the images. Once you have these placeholders, it's
> easy.
> You can find a code sample on how to put the images inside these
> placeholders

FWIW, I had to explicitly remove the field.  I thought the "overcontent"
would put it on top of the fields, but it didn't.

Bear



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

-----------------------------------------
The information in this message may be proprietary and/or
confidential, and protected from disclosure.  If the reader of this
message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify First Data
immediately by replying to this message and deleting it from your
computer.



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to