@@ -168,6 +168,31 @@ public virtual void CopyFieldsTest05() {
168
168
, destinationFolder , "diff_" ) ) ;
169
169
}
170
170
171
+ /// <exception cref="System.IO.IOException"/>
172
+ /// <exception cref="System.Exception"/>
173
+ [ NUnit . Framework . Test ]
174
+ [ LogMessage ( iText . IO . LogMessageConstant . DOCUMENT_ALREADY_HAS_FIELD , Count = 2 ) ]
175
+ public virtual void CopyMultipleSubfieldsTest01 ( ) {
176
+ String srcFilename = sourceFolder + "copyMultipleSubfieldsTest01.pdf" ;
177
+ String destFilename = destinationFolder + "copyMultipleSubfieldsTest01.pdf" ;
178
+ PdfDocument srcDoc = new PdfDocument ( new PdfReader ( srcFilename ) ) ;
179
+ PdfDocument destDoc = new PdfDocument ( new PdfWriter ( destFilename ) ) ;
180
+ PdfPageFormCopier pdfPageFormCopier = new PdfPageFormCopier ( ) ;
181
+ // copying the same page from the same document twice
182
+ for ( int i = 0 ; i < 2 ; ++ i ) {
183
+ srcDoc . CopyPagesTo ( 1 , 1 , destDoc , pdfPageFormCopier ) ;
184
+ }
185
+ PdfAcroForm acroForm = PdfAcroForm . GetAcroForm ( destDoc , false ) ;
186
+ acroForm . GetField ( "text_1" ) . SetValue ( "Text 1!" ) ;
187
+ acroForm . GetField ( "text_2" ) . SetValue ( "Text 2!" ) ;
188
+ acroForm . GetField ( "text.3" ) . SetValue ( "Text 3!" ) ;
189
+ acroForm . GetField ( "text.4" ) . SetValue ( "Text 4!" ) ;
190
+ destDoc . Close ( ) ;
191
+ srcDoc . Close ( ) ;
192
+ NUnit . Framework . Assert . IsNull ( new CompareTool ( ) . CompareByContent ( destFilename , sourceFolder + "cmp_copyMultipleSubfieldsTest01.pdf"
193
+ , destinationFolder , "diff_" ) ) ;
194
+ }
195
+
171
196
/// <exception cref="System.IO.IOException"/>
172
197
/// <exception cref="System.Exception"/>
173
198
[ NUnit . Framework . Test ]
0 commit comments