@@ -101,7 +101,7 @@ This file is part of the iText (R) project.
101
101
/**
102
102
* This class represents a single field or field group in an {@link com.itextpdf.forms.PdfAcroForm
103
103
* AcroForm}.
104
- * <p>
104
+ *
105
105
* <br><br>
106
106
* To be able to be wrapped with this {@link PdfObjectWrapper} the {@link PdfObject}
107
107
* must be indirect.
@@ -121,6 +121,7 @@ public class PdfFormField extends PdfObjectWrapper<PdfDictionary> {
121
121
122
122
/**
123
123
* Size of text in form fields when font size is not explicitly set.
124
+ *
124
125
* @deprecated Will be made package-private in iText 7.2.
125
126
*/
126
127
@ Deprecated
@@ -1658,22 +1659,16 @@ public PdfString getDefaultAppearance() {
1658
1659
* Sets default appearance string containing a sequence of valid page-content graphics or text state operators that
1659
1660
* define such properties as the field's text size and color.
1660
1661
*
1661
- * If form field has the same default appearance (incl. inherited) it won't be updated.
1662
- *
1663
1662
* @param defaultAppearance a valid sequence of PDF content stream syntax
1664
1663
* @return the edited field
1665
1664
*/
1666
1665
public PdfFormField setDefaultAppearance (String defaultAppearance ) {
1667
- PdfString prev = getDefaultAppearance ();
1668
- if (prev == null || !defaultAppearance .trim ().equals (prev .getValue ().trim ()) || true ) {
1669
- byte [] b = defaultAppearance .getBytes (StandardCharsets .UTF_8 );
1670
- int len = b .length ;
1671
- for (int k = 0 ; k < len ; ++k ) {
1672
- if (b [k ] == '\n' )
1673
- b [k ] = 32 ;
1674
- }
1675
- getPdfObject ().put (PdfName .DA , new PdfString (new String (b )));
1666
+ byte [] b = defaultAppearance .getBytes (StandardCharsets .UTF_8 );
1667
+ for (int k = 0 ; k < b .length ; ++k ) {
1668
+ if (b [k ] == '\n' )
1669
+ b [k ] = 32 ;
1676
1670
}
1671
+ getPdfObject ().put (PdfName .DA , new PdfString (new String (b )));
1677
1672
return this ;
1678
1673
}
1679
1674
@@ -2633,7 +2628,7 @@ protected static PdfArray processOptions(String[] options) {
2633
2628
/**
2634
2629
* Generate default appearance, /DA key.
2635
2630
*
2636
- * @param font preferred font. If {@link #getFont()} is not null, it will be used instead.
2631
+ * @param font preferred font. If {@link #getFont()} is not null, it will be used instead.
2637
2632
* @param fontSize preferred font size. If {@link PdfFormField#fontSize} is valid,
2638
2633
* it will be used instead.
2639
2634
* @return generated string
@@ -3077,9 +3072,9 @@ protected void drawRadioField(PdfCanvas canvas, float width, float height, boole
3077
3072
/**
3078
3073
* Draws the appearance of a checkbox with a specified state value.
3079
3074
*
3080
- * @param width the width of the checkbox to draw
3081
- * @param height the height of the checkbox to draw
3082
- * @param onStateName the state of the form field that will be drawn
3075
+ * @param width the width of the checkbox to draw
3076
+ * @param height the height of the checkbox to draw
3077
+ * @param onStateName the state of the form field that will be drawn
3083
3078
*/
3084
3079
protected void drawCheckAppearance (float width , float height , String onStateName ) {
3085
3080
PdfStream streamOn = (PdfStream ) new PdfStream ().makeIndirect (getDocument ());
@@ -3179,6 +3174,26 @@ protected void drawPdfA2CheckAppearance(float width, float height, String value,
3179
3174
* @param font a {@link PdfFont}
3180
3175
* @param fontSize the size of the font
3181
3176
* @return a new {@link PdfFormXObject}
3177
+ * @deprecated Will be removed in 7.2.
3178
+ * @see #drawPushButtonAppearance(float, float, String, PdfFont, PdfName, float)
3179
+ */
3180
+ @ Deprecated
3181
+ protected PdfFormXObject drawPushButtonAppearance (float width , float height , String text ,
3182
+ PdfFont font , float fontSize ) {
3183
+ return drawPushButtonAppearance (width , height , text , font , null , fontSize );
3184
+
3185
+ }
3186
+
3187
+ /**
3188
+ * Draws the appearance for a push button.
3189
+ *
3190
+ * @param width the width of the pushbutton
3191
+ * @param height the width of the pushbutton
3192
+ * @param text the text to display on the button
3193
+ * @param font a {@link PdfFont}
3194
+ * @param fontName fontName in DR.
3195
+ * @param fontSize the size of the font
3196
+ * @return a new {@link PdfFormXObject}
3182
3197
*/
3183
3198
protected PdfFormXObject drawPushButtonAppearance (float width , float height , String text ,
3184
3199
PdfFont font , PdfName fontName , float fontSize ) {
0 commit comments