@@ -171,15 +171,15 @@ public virtual void CopyFieldsTest05() {
171
171
/// <exception cref="System.IO.IOException"/>
172
172
/// <exception cref="System.Exception"/>
173
173
[ NUnit . Framework . Test ]
174
- [ LogMessage ( iText . IO . LogMessageConstant . DOCUMENT_ALREADY_HAS_FIELD , Count = 4 ) ]
174
+ [ LogMessage ( iText . IO . LogMessageConstant . DOCUMENT_ALREADY_HAS_FIELD , Count = 12 ) ]
175
175
public virtual void CopyMultipleSubfieldsTest01 ( ) {
176
176
String srcFilename = sourceFolder + "copyMultipleSubfieldsTest01.pdf" ;
177
177
String destFilename = destinationFolder + "copyMultipleSubfieldsTest01.pdf" ;
178
178
PdfDocument srcDoc = new PdfDocument ( new PdfReader ( srcFilename ) ) ;
179
179
PdfDocument destDoc = new PdfDocument ( new PdfWriter ( destFilename ) ) ;
180
180
PdfPageFormCopier pdfPageFormCopier = new PdfPageFormCopier ( ) ;
181
181
// copying the same page from the same document twice
182
- for ( int i = 0 ; i < 2 ; ++ i ) {
182
+ for ( int i = 0 ; i < 4 ; ++ i ) {
183
183
srcDoc . CopyPagesTo ( 1 , 1 , destDoc , pdfPageFormCopier ) ;
184
184
}
185
185
PdfAcroForm acroForm = PdfAcroForm . GetAcroForm ( destDoc , false ) ;
@@ -193,6 +193,50 @@ public virtual void CopyMultipleSubfieldsTest01() {
193
193
, destinationFolder , "diff_" ) ) ;
194
194
}
195
195
196
+ /// <exception cref="System.IO.IOException"/>
197
+ /// <exception cref="System.Exception"/>
198
+ [ NUnit . Framework . Test ]
199
+ [ LogMessage ( iText . IO . LogMessageConstant . DOCUMENT_ALREADY_HAS_FIELD , Count = 2 ) ]
200
+ public virtual void CopyMultipleSubfieldsTest02 ( ) {
201
+ String srcFilename = sourceFolder + "copyMultipleSubfieldsTest02.pdf" ;
202
+ String destFilename = destinationFolder + "copyMultipleSubfieldsTest02.pdf" ;
203
+ PdfDocument srcDoc = new PdfDocument ( new PdfReader ( srcFilename ) ) ;
204
+ PdfDocument destDoc = new PdfDocument ( new PdfWriter ( destFilename ) ) ;
205
+ PdfPageFormCopier pdfPageFormCopier = new PdfPageFormCopier ( ) ;
206
+ // copying the same page from the same document twice
207
+ for ( int i = 0 ; i < 3 ; ++ i ) {
208
+ srcDoc . CopyPagesTo ( 1 , 1 , destDoc , pdfPageFormCopier ) ;
209
+ }
210
+ PdfAcroForm acroForm = PdfAcroForm . GetAcroForm ( destDoc , false ) ;
211
+ acroForm . GetField ( "text.3" ) . SetValue ( "Text 3!" ) ;
212
+ destDoc . Close ( ) ;
213
+ srcDoc . Close ( ) ;
214
+ NUnit . Framework . Assert . IsNull ( new CompareTool ( ) . CompareByContent ( destFilename , sourceFolder + "cmp_copyMultipleSubfieldsTest02.pdf"
215
+ , destinationFolder , "diff_" ) ) ;
216
+ }
217
+
218
+ /// <exception cref="System.IO.IOException"/>
219
+ /// <exception cref="System.Exception"/>
220
+ [ NUnit . Framework . Test ]
221
+ [ LogMessage ( iText . IO . LogMessageConstant . DOCUMENT_ALREADY_HAS_FIELD , Count = 2 ) ]
222
+ public virtual void CopyMultipleSubfieldsTest03 ( ) {
223
+ String srcFilename = sourceFolder + "copyMultipleSubfieldsTest03.pdf" ;
224
+ String destFilename = destinationFolder + "copyMultipleSubfieldsTest03.pdf" ;
225
+ PdfDocument srcDoc = new PdfDocument ( new PdfReader ( srcFilename ) ) ;
226
+ PdfDocument destDoc = new PdfDocument ( new PdfWriter ( destFilename ) ) ;
227
+ PdfPageFormCopier pdfPageFormCopier = new PdfPageFormCopier ( ) ;
228
+ // copying the same page from the same document twice
229
+ for ( int i = 0 ; i < 3 ; ++ i ) {
230
+ srcDoc . CopyPagesTo ( 1 , 1 , destDoc , pdfPageFormCopier ) ;
231
+ }
232
+ PdfAcroForm acroForm = PdfAcroForm . GetAcroForm ( destDoc , false ) ;
233
+ acroForm . GetField ( "text_1" ) . SetValue ( "Text 1!" ) ;
234
+ destDoc . Close ( ) ;
235
+ srcDoc . Close ( ) ;
236
+ NUnit . Framework . Assert . IsNull ( new CompareTool ( ) . CompareByContent ( destFilename , sourceFolder + "cmp_copyMultipleSubfieldsTest03.pdf"
237
+ , destinationFolder , "diff_" ) ) ;
238
+ }
239
+
196
240
/// <exception cref="System.IO.IOException"/>
197
241
/// <exception cref="System.Exception"/>
198
242
[ NUnit . Framework . Test ]
0 commit comments