@@ -1109,5 +1109,32 @@ private void FillAcroForm(PdfDocument pdfDocument, String text) {
1109
1109
field . SetValue ( text ) ;
1110
1110
}
1111
1111
}
1112
+
1113
+ /// <exception cref="System.IO.IOException"/>
1114
+ /// <exception cref="System.Exception"/>
1115
+ [ NUnit . Framework . Test ]
1116
+ public virtual void SetFont3Ways ( ) {
1117
+ String filename = destinationFolder + "setFont3Ways.pdf" ;
1118
+ String cmpFilename = sourceFolder + "cmp_setFont3Ways.pdf" ;
1119
+ String testString = "Don't cry over spilt milk" ;
1120
+ PdfDocument pdfDocument = new PdfDocument ( new PdfWriter ( filename ) ) ;
1121
+ PdfAcroForm form = PdfAcroForm . GetAcroForm ( pdfDocument , true ) ;
1122
+ PdfFont font = PdfFontFactory . CreateFont ( sourceFolder + "SILEOT.ttf" , PdfEncodings . IDENTITY_H ) ;
1123
+ Rectangle rect1 = new Rectangle ( 10 , 700 , 200 , 25 ) ;
1124
+ Rectangle rect2 = new Rectangle ( 30 , 600 , 200 , 25 ) ;
1125
+ Rectangle rect3 = new Rectangle ( 50 , 500 , 200 , 25 ) ;
1126
+ PdfButtonFormField pushButton1 = PdfFormField . CreatePushButton ( pdfDocument , rect1 , "Name1" , testString , font
1127
+ , 12 ) ;
1128
+ form . AddField ( pushButton1 ) ;
1129
+ PdfButtonFormField pushButton2 = PdfFormField . CreatePushButton ( pdfDocument , rect2 , "Name2" , testString ) ;
1130
+ pushButton2 . SetFontAndSize ( font , 12f ) ;
1131
+ form . AddField ( pushButton2 ) ;
1132
+ PdfButtonFormField pushButton3 = PdfFormField . CreatePushButton ( pdfDocument , rect3 , "Name3" , testString ) ;
1133
+ pushButton3 . SetFont ( font ) . SetFontSize ( 12 ) ;
1134
+ form . AddField ( pushButton3 ) ;
1135
+ pdfDocument . Close ( ) ;
1136
+ NUnit . Framework . Assert . IsNull ( new CompareTool ( ) . CompareByContent ( filename , cmpFilename , destinationFolder ,
1137
+ "diff_" ) ) ;
1138
+ }
1112
1139
}
1113
1140
}
0 commit comments