@@ -46,6 +46,7 @@ This file is part of the iText (R) project.
46
46
import com .itextpdf .io .source .ByteArrayOutputStream ;
47
47
import com .itextpdf .io .source .ByteUtils ;
48
48
import com .itextpdf .kernel .PdfException ;
49
+ import com .itextpdf .kernel .utils .CompareTool ;
49
50
import com .itextpdf .test .ExtendedITextTest ;
50
51
import com .itextpdf .test .annotations .LogMessage ;
51
52
import com .itextpdf .test .annotations .LogMessages ;
@@ -1477,6 +1478,28 @@ public void freeReferencesTest() throws IOException {
1477
1478
pdfDoc .close ();
1478
1479
}
1479
1480
1481
+ @ Test
1482
+ public void freeReferencesTest02 () throws IOException , InterruptedException {
1483
+
1484
+ String cmpFile = sourceFolder + "cmp_freeReferences02.pdf" ;
1485
+ String outputFile = destinationFolder + "freeReferences02.pdf" ;
1486
+ String inputFile = sourceFolder + "freeReferences02.pdf" ;
1487
+
1488
+ PdfWriter writer = new PdfWriter (outputFile );
1489
+ PdfReader reader = new PdfReader (inputFile );
1490
+
1491
+ PdfDocument inputPdfDocument = new PdfDocument (reader );
1492
+ PdfDocument outputPdfDocument = new PdfDocument (writer );
1493
+
1494
+ int lastPage = inputPdfDocument .getNumberOfPages ();
1495
+ inputPdfDocument .copyPagesTo (lastPage , lastPage , outputPdfDocument );
1496
+
1497
+ inputPdfDocument .close ();
1498
+ outputPdfDocument .close ();
1499
+
1500
+ Assert .assertNull (new CompareTool ().compareByContent (outputFile , cmpFile , destinationFolder , "diff_" ));
1501
+ }
1502
+
1480
1503
@ Test
1481
1504
public void pdfVersionTest () throws IOException {
1482
1505
String filename = sourceFolder + "hello.pdf" ;
0 commit comments