@@ -1665,7 +1665,7 @@ public PdfString getDefaultAppearance() {
1665
1665
*/
1666
1666
public PdfFormField setDefaultAppearance (String defaultAppearance ) {
1667
1667
PdfString prev = getDefaultAppearance ();
1668
- if (prev == null || !defaultAppearance .trim ().equals (prev .getValue ().trim ())) {
1668
+ if (prev == null || !defaultAppearance .trim ().equals (prev .getValue ().trim ()) || true ) {
1669
1669
byte [] b = defaultAppearance .getBytes (StandardCharsets .UTF_8 );
1670
1670
int len = b .length ;
1671
1671
for (int k = 0 ; k < len ; ++k ) {
@@ -3183,7 +3183,8 @@ protected void drawPdfA2CheckAppearance(float width, float height, String value,
3183
3183
protected PdfFormXObject drawPushButtonAppearance (float width , float height , String text ,
3184
3184
PdfFont font , PdfName fontName , float fontSize ) {
3185
3185
PdfStream stream = (PdfStream ) new PdfStream ().makeIndirect (getDocument ());
3186
- PdfCanvas canvas = new PdfCanvas (stream , new PdfResources (), getDocument ());
3186
+ AppearanceResources resources = new AppearanceResources ().addFontFromDefaultResources (fontName , font );
3187
+ PdfCanvas canvas = new PdfCanvas (stream , resources , getDocument ());
3187
3188
3188
3189
AppearanceXObject xObject = new AppearanceXObject (new Rectangle (0 , 0 , width , height ));
3189
3190
drawBorder (canvas , xObject , width , height );
@@ -3198,7 +3199,7 @@ protected PdfFormXObject drawPushButtonAppearance(float width, float height, Str
3198
3199
} else {
3199
3200
drawButton (canvas , 0 , 0 , width , height , text , font , fontSize );
3200
3201
xObject .addFontFromDR (fontName , font );
3201
- setDefaultAppearance (generateDefaultAppearanceString (font , fontSize , color , new PdfResources () ));
3202
+ setDefaultAppearance (generateDefaultAppearanceString (font , fontSize , color , resources ));
3202
3203
xObject .getResources ().addFont (getDocument (), font );
3203
3204
}
3204
3205
xObject .getPdfObject ().getOutputStream ().writeBytes (stream .getBytes ());
0 commit comments