Here is the code we are trying after going over the javadocs and C# source.

PdfReader pdfreader = new PdfReader( "initial doc.pdf "); 
PdfStamper stamp = new PdfStamper(pdfreader, new FileStream( "Final.pdf ",
FileMode.Create)); 

PushbuttonField bt = new PushbuttonField(stamp.Writer, new Rectangle(100,
100, 200 , 200), "bt1 "); 

bt.Layout = PushbuttonField.LAYOUT_ICON_ONLY; 
bt.setScaleIcon = PushbuttonField.SCALE_ICON_ALWAYS; 
bt.Visibility = BaseField.VISIBLE; 
bt.IconFitToBounds =true; 

PdfFormField ff = bt.Field;

//Does not seem to change the type PUSH
ff.SetHighlighting(PdfAnnotation.HIGHLIGHT_PUSH);

ff.SetWidget(new Rectangle(100, 100, 200 , 200 ),
PdfAnnotation.HIGHLIGHT_PUSH);

//LOAD BUTTON FACE FROM PDF
PdfReader pdfr = new PdfReader( "NORMAL.pdf "); 
PdfImportedPage normal_icon = stamp.GetImportedPage(pdfr,1);
bt.Template = normal_icon; 
ff.SetAppearance(PdfAnnotation.APPEARANCE_NORMAL,bt.GetAppearance());

//GET ROLLOVER IMAGE
pdfr = new PdfReader( "ROLLOVER.pdf "); 
PdfImportedPage rollover_image = stamp.GetImportedPage(pdfr,1);
bt.Template = rollover_image; 
ff.SetAppearance(PdfAnnotation.APPEARANCE_ROLLOVER,bt.GetAppearance());

stamp.AddAnnotation(bt.Field, 1); 
                                
stamp.Close();  

Creates push button as type INVERT with the rollover_image as the face on
the invert button.







-----Original Message-----
From: Paulo Soares [mailto:[EMAIL PROTECTED] 
Sent: Saturday, February 11, 2006 9:47 AM
To: Dan Phillips; [email protected]
Subject: Re: [iText-questions] SetAppearance not found for the
PushButtonField object

ff.setHighlighting(PdfAnnotation.HIGHLIGHT_PUSH);

PS: This is in the javadocs

----- Original Message -----
From: "Dan Phillips" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, February 11, 2006 2:15 PM
Subject: RE: [iText-questions] SetAppearance not found for the
PushButtonField object


>
> Thanks, our only problem now is that when we create the 
> PudhButtonField it is always created as an INVERT button.  How do we 
> change the type of button to a 'PUSH' button with the three faces.
>
> PushbuttonField bt = new PushbuttonField(stamp.Writer, new 
> Rectangle(100, 100, 100 + ll.Width, 100 + ll.Height), "bt1 "); 
> PdfFormField ff = bt.Field; ff.SetWidget(new Rectangle(100, 100, 100 + 
> ll.Width, 100 + ll.Height), PdfAnnotation.HIGHLIGHT_PUSH);
>
>
> -----Original Message-----
> From: Paulo Soares [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 10, 2006 6:33 PM
> To: Dan Phillips; [email protected]
> Subject: Re: [iText-questions] SetAppearance not found for the 
> PushButtonField object
>
> From the javadocs:
>
> PdfFormField ff = bt.getField();
>
> For the other appearances using the same bt instance:
>
> bt.setImage(image_down);
> ff.setAppearance(PdfAnnotation.APPEARANCE_DOWN, bt.getAppearance()); 
> bt.setImage(image_rollover); 
> ff.setAppearance(PdfAnnotation.APPEARANCE_ROLLOVER, 
> bt.getAppearance());
>
>
> ----- Original Message -----
> From: "Dan Phillips" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Friday, February 10, 2006 11:10 PM
> Subject: [iText-questions] SetAppearance not found for the 
> PushButtonField object
>
>
>> No problem with that. Use the code in the PushbuttonField javadoc but 
>> instead of an image use a template with a PDF page inside. The result 
>> is a button with a normal appearance. To set the other appearances 
>> set another template with another page in the same PushbuttonField 
>> instance, call
>> getApperance() and in the previously returned field call
>> setAppearance() with the down or rollover key. You need the iText 
>> version in the CVS to do that.
>>
>> Paulo
>>
>> We are unable to locate the setappearance method to change the 
>> appearance for the different faces of a push button,
>>
>> We looked in the cvs and the setappearance method is not there,
>>
>> Set Appearance is available with the PdfFormField object but not the 
>> PushButtonField
>>
>> We used the PushButtonField object to create the push button and we 
>> have added the getAppearance code to the itextsharp dll .
>>
>> Regards
>>
>> Dan Phillips
>>
>>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log 
> files for problems?  Stop!  Download the new AJAX search engine that 
> makes searching your log files as easy as surfing the  web.  DOWNLOAD 
> SPLUNK!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=1216
> 42 _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to