See the class PdfPushbuttonField in the new release at
http://itextpdf.sf.net.

--- Christopher Parkins <[EMAIL PROTECTED]> wrote:
> Hey all,
> 
> I am trying to use the PdfFormField to make a
> FormField with an image.  I have found some
> examples,
> that seem to be working, but the image is not
> showing
> up when I open the form.  Also when I look at the
> properties of the Field the Layout Option is set to
> "Label Only", I can go in and manually change it to
> "Icon Only" and add the image correctly.  I would
> like
> to be able to dynamically do this to show the
> pictures
> on a Form, but not print them.
> 
> Here is the code that I am currently using.
> 
> public void addImage(Image img, int x, int y, bool
> printable)
> {
> 
> float w = img.scaledWidth();
> float h = img.scaledHeight();
> 
> cb.moveTo(0,0);
> 
> PdfFormField field =
> PdfFormField.createPushButton(writer);
> 
> field.setFieldFlags( PdfFormField.FF_READ_ONLY );
> 
> PdfAppearance appearance =
>
cb.createAppearance(img.scaledWidth(),img.scaledHeight());
> 
> img.setAbsolutePosition(x,yPos - y);
>
img.scaleAbsolute(img.scaledWidth(),img.scaledHeight());
> 
> field.setWidget(new Rectangle(x,yPos - y - h,x +
> w,yPos - y),PdfAnnotation.HIGHLIGHT_NONE);
>                               field.setFieldName("Background");
> 
> PdfTemplate template = cb.createTemplate(w,h);
> template.addImage(img);
>                               field.setMKNormalIcon(template);
>       
>
field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL,template);
> 
> writer.addAnnotation(field,1);
> }
> 
> I'm not sure if this is the correct way to do what I
> would like to do.  Any suggestions would be very
> helpful.
> 
> Thanks,
> 
> Chris Parkins
> 
> 
>               
> __________________________________ 
> Do you Yahoo!? 
> Yahoo! Small Business - Try our new resources site!
> http://smallbusiness.yahoo.com/resources/ 
> 
> 
>
-------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT
> Products from real users.
> Discover which products truly live up to the hype.
> Start reading now.
>
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
>
https://lists.sourceforge.net/lists/listinfo/itext-questions
> 


                
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to