>Is there a way to use iText to set an imagefield in an acro form similar to 
>what can be done with textfields? 

Kinda.  There's no such thing as an "image field" in an AcroForm.  That being 
said, you can set a button's appearance to "Icon Only", and draw whatever you 
like for the 'icon'... in theory.

Creating a button field from scratch with an icon appearance is fairly simple 
with PushbuttonField.  Modifying an existing button is considerably more 
challenging, and requires significant PDF knowledge.  PdfContentByte's 
drawButton() won't help.  Nor will AcroFields.getAppearance().

The only realistic option for you would be something like this:

------------

AcroField.Item fldItem = form.getFieldItem( "buttonName" )

for (int i = 0; i < fldItem.widgets.size(); ++i) {
    Pushbutton button = new PushButton(...);
    PdfDictionary curWidg = (PdfDictionary)fldItem.widgets.get( i );
    PdfDictionary curMerged = (PdfDictionary)fldItem.merged.get( i );

    myAttributeSetter( button, curMerged ); // exercise for the reader

    PdfFormField tmpField = button.getField();

    PdfObject apObj = tmpField.get( PdfName.AP );
    PdfObject mkObj = tmpField.get( PdfName.MK ):
    
    curWidg.put( PdfName.AP, apObj );
    curMerged.put (PdfName.AP, apObj );

    curWidg.put( PdfName.MK, mkObj );
    curMerged.put( PdfName.MK, mkObj );
}

------------

myAttributeSetter() will be "non-trivial", particuarly for someone unfamiliar 
with PDF.  Bounding boxes, field flags, etc, etc.  You'll want to take a long 
look at chapter 8's section on form fields in the PDF Reference.

--Mark Storer 
  Senior Software Engineer 
  Cardiff Software 
#include <disclaimer> 
typedef std::Disclaimer<Cardiff> DisCard; 

-------------------------------------------------------------------------
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