Skip to content

Commit cbe0066

Browse files
committed
[RELEASE] iText 7 Core - 7.1.4
https://github.com/itext/itext7/releases/tag/7.1.4 * release/7.1.4: [RELEASE] 7.1.4-SNAPSHOT -> 7.1.4 Update too old cmp file for full compression test Remove relativePath from svg pom Fix copying fields during multiple page copying Create a copy for form field with name contains dot symbol Add test. DEVSIX-2187 Add some new SVG tests. Squash multiple spaces into one if necessary. Update the path-processing algo. Add a new SVG test that demonstrates some Path-related issues. Update some method names in accordance with the naming convention. Add PdfDocument#findFont() for already added PdfFonts Create a unique name for each OCProperties. Update some cmps. SXP: Free resources after reading them add test for DEVSIX-2156 Revert [a69a813] "Fix bug in CompareTool when pdfstream from output file has filter different from cmp file" Reformat CompareTool javadocs, add details about diffPrefix arg to all overloads Add new overload for CompareTool#compareByContent which generates diff preffix based off output file name Fix bug in CompareTool when pdfstream from output file has filter different from cmp file Fix some minor min/max width algo issues. Update some cmps. Add missing copyright headers Path parsing updates Do not substitute a symbol with itself during line transformations. Add implementation for Path operators v and h. RND-1108 Make method public for pdfHtml Fix PdfSweep failure on documents with ligatures Removing relativePath from pom file QA-529 Fix up for styled-xml-parser and svg resources in pom Fix typo in gsParam Add -dSAFER to gsParams Simplify POM files for styled-xml-parser and svg, so they use the values set in the root POM Add missing copyright headers Add styled-xml-parser and svg to pom.xml Add 'svg/' from commit '65c48971f2a171497d73e2a4ed883333a0f34b73' ... Add 'styled-xml-parser/' from commit 'b35a24b753cb7932156925141a7e7d658db4eee7' ... Add new unit fontselector tests for open sans font-family. Add new font selector unit tests for standard fonts. Update cmps. Fix issues with additional separator in ResourceResolver Update the javadoc and some ticket-references. Handle the default font-family correctly. Unify the font selector algorithm with the browser's one. Refactor the FontSelector algo. Add missing copyright headers Ignore memory hungry hyphen tests (layout) Allow additional x509 extensions to be critical, as discussed in Ticket SUP-2885. Add test and refactor for PR-27. DEVSIX-1982 Fix version replacement in CompareTool Fix bug Properly check to remove root outline. DEVSIX-2046 Deprecate FileUtil#getParentDirectory(String file) DESIX-2049 move functionality from svg class to io FileUtil Update new lines in pom.xml Add missing copyright headers Move to DocumentCloneTest class in samples-internal project Reflect the test method name Remove versionInfo NPE when deserialize lower version of PdfDocument [RELEASE] Merge master into develop [RELEASE] 7.1.3-SNAPSHOT -> 7.1.4-SNAPSHOT Sort dependencies in pom.xml Add test. DEVSIX-1669 add test for DEVSIX-2046
2 parents e7dc8b3 + b3b6e92 commit cbe0066

File tree

1,211 files changed

+93131
-456
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,211 files changed

+93131
-456
lines changed

barcodes/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.itextpdf</groupId>
66
<artifactId>root</artifactId>
7-
<version>7.1.3</version>
7+
<version>7.1.4</version>
88
</parent>
99
<artifactId>barcodes</artifactId>
1010
<name>iText 7 - barcodes</name>

font-asian/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.itextpdf</groupId>
66
<artifactId>root</artifactId>
7-
<version>7.1.3</version>
7+
<version>7.1.4</version>
88
</parent>
99
<artifactId>font-asian</artifactId>
1010
<name>iText 7 - Asian fonts</name>

forms/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.itextpdf</groupId>
66
<artifactId>root</artifactId>
7-
<version>7.1.3</version>
7+
<version>7.1.4</version>
88
</parent>
99
<artifactId>forms</artifactId>
1010
<name>iText 7 - forms</name>

forms/src/main/java/com/itextpdf/forms/PdfPageFormCopier.java

Lines changed: 158 additions & 90 deletions
Large diffs are not rendered by default.

forms/src/test/java/com/itextpdf/forms/FormFieldFlatteningTest.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,18 @@ This file is part of the iText (R) project.
4444

4545
import com.itextpdf.forms.fields.PdfFormField;
4646
import com.itextpdf.forms.fields.PdfTextFormField;
47+
import com.itextpdf.io.LogMessageConstant;
4748
import com.itextpdf.kernel.colors.DeviceRgb;
4849
import com.itextpdf.kernel.pdf.PdfDocument;
4950
import com.itextpdf.kernel.pdf.PdfReader;
5051
import com.itextpdf.kernel.pdf.PdfWriter;
5152
import com.itextpdf.kernel.utils.CompareTool;
5253
import com.itextpdf.test.ExtendedITextTest;
54+
import com.itextpdf.test.annotations.LogMessage;
55+
import com.itextpdf.test.annotations.LogMessages;
5356
import com.itextpdf.test.annotations.type.IntegrationTest;
57+
58+
import java.io.ByteArrayOutputStream;
5459
import java.io.IOException;
5560
import org.junit.Assert;
5661
import org.junit.BeforeClass;
@@ -201,4 +206,28 @@ private static void fillTextFieldsThenFlattenThenCompare(String testName) throws
201206

202207
Assert.assertNull(new CompareTool().compareByContent(dest, cmp, destinationFolder, "diff_"));
203208
}
209+
210+
@Test
211+
@LogMessages(messages = {@LogMessage(messageTemplate = LogMessageConstant.DOCUMENT_ALREADY_HAS_FIELD, count = 3)})
212+
//Logging is expected since there are duplicate field names
213+
//isReadOnly should be true after DEVSIX-2156
214+
public void flattenReadOnly() throws IOException{
215+
PdfWriter writer = new PdfWriter(new ByteArrayOutputStream());
216+
PdfDocument pdfDoc = new PdfDocument(writer);
217+
PdfReader reader = new PdfReader(sourceFolder + "readOnlyForm.pdf");
218+
PdfDocument pdfInnerDoc = new PdfDocument(reader);
219+
pdfInnerDoc.copyPagesTo(1, pdfInnerDoc.getNumberOfPages(), pdfDoc, new PdfPageFormCopier());
220+
pdfInnerDoc.close();
221+
reader = new PdfReader(sourceFolder + "readOnlyForm.pdf");
222+
pdfInnerDoc = new PdfDocument(reader);
223+
pdfInnerDoc.copyPagesTo(1, pdfInnerDoc.getNumberOfPages(), pdfDoc, new PdfPageFormCopier());
224+
pdfInnerDoc.close();
225+
PdfAcroForm form = PdfAcroForm.getAcroForm(pdfDoc, false);
226+
boolean isReadOnly = true;
227+
for (PdfFormField field : form.getFormFields().values()){
228+
isReadOnly = (isReadOnly && field.isReadOnly());
229+
}
230+
pdfDoc.close();
231+
Assert.assertFalse(isReadOnly);
232+
}
204233
}

forms/src/test/java/com/itextpdf/forms/PdfFormCopyTest.java

Lines changed: 113 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,91 @@ public void copyFieldsTest05() throws IOException, InterruptedException {
192192
Assert.assertNull(new CompareTool().compareByContent(destFilename, sourceFolder + "cmp_copyFields05.pdf", destinationFolder, "diff_"));
193193
}
194194

195+
196+
@Test
197+
@LogMessages(messages = {
198+
@LogMessage(messageTemplate = LogMessageConstant.DOCUMENT_ALREADY_HAS_FIELD, count = 12)
199+
})
200+
public void copyMultipleSubfieldsTest01() throws IOException, InterruptedException {
201+
String srcFilename = sourceFolder + "copyMultipleSubfieldsTest01.pdf";
202+
String destFilename = destinationFolder + "copyMultipleSubfieldsTest01.pdf";
203+
204+
PdfDocument srcDoc = new PdfDocument(new PdfReader(srcFilename));
205+
PdfDocument destDoc = new PdfDocument(new PdfWriter(destFilename));
206+
207+
PdfPageFormCopier pdfPageFormCopier = new PdfPageFormCopier();
208+
// copying the same page from the same document twice
209+
for (int i = 0; i < 4; ++i) {
210+
srcDoc.copyPagesTo(1, 1, destDoc, pdfPageFormCopier);
211+
}
212+
213+
PdfAcroForm acroForm = PdfAcroForm.getAcroForm(destDoc, false);
214+
215+
acroForm.getField("text_1").setValue("Text 1!");
216+
acroForm.getField("text_2").setValue("Text 2!");
217+
acroForm.getField("text.3").setValue("Text 3!");
218+
acroForm.getField("text.4").setValue("Text 4!");
219+
220+
destDoc.close();
221+
srcDoc.close();
222+
223+
Assert.assertNull(new CompareTool().compareByContent(destFilename, sourceFolder + "cmp_copyMultipleSubfieldsTest01.pdf", destinationFolder, "diff_"));
224+
}
225+
226+
@Test
227+
@LogMessages(messages = {
228+
@LogMessage(messageTemplate = LogMessageConstant.DOCUMENT_ALREADY_HAS_FIELD, count = 2)
229+
})
230+
public void copyMultipleSubfieldsTest02() throws IOException, InterruptedException {
231+
String srcFilename = sourceFolder + "copyMultipleSubfieldsTest02.pdf";
232+
String destFilename = destinationFolder + "copyMultipleSubfieldsTest02.pdf";
233+
234+
PdfDocument srcDoc = new PdfDocument(new PdfReader(srcFilename));
235+
PdfDocument destDoc = new PdfDocument(new PdfWriter(destFilename));
236+
237+
PdfPageFormCopier pdfPageFormCopier = new PdfPageFormCopier();
238+
// copying the same page from the same document twice
239+
for (int i = 0; i < 3; ++i) {
240+
srcDoc.copyPagesTo(1, 1, destDoc, pdfPageFormCopier);
241+
}
242+
243+
PdfAcroForm acroForm = PdfAcroForm.getAcroForm(destDoc, false);
244+
245+
acroForm.getField("text.3").setValue("Text 3!");
246+
247+
destDoc.close();
248+
srcDoc.close();
249+
250+
Assert.assertNull(new CompareTool().compareByContent(destFilename, sourceFolder + "cmp_copyMultipleSubfieldsTest02.pdf", destinationFolder, "diff_"));
251+
}
252+
253+
@Test
254+
@LogMessages(messages = {
255+
@LogMessage(messageTemplate = LogMessageConstant.DOCUMENT_ALREADY_HAS_FIELD, count = 2)
256+
})
257+
public void copyMultipleSubfieldsTest03() throws IOException, InterruptedException {
258+
String srcFilename = sourceFolder + "copyMultipleSubfieldsTest03.pdf";
259+
String destFilename = destinationFolder + "copyMultipleSubfieldsTest03.pdf";
260+
261+
PdfDocument srcDoc = new PdfDocument(new PdfReader(srcFilename));
262+
PdfDocument destDoc = new PdfDocument(new PdfWriter(destFilename));
263+
264+
PdfPageFormCopier pdfPageFormCopier = new PdfPageFormCopier();
265+
// copying the same page from the same document twice
266+
for (int i = 0; i < 3; ++i) {
267+
srcDoc.copyPagesTo(1, 1, destDoc, pdfPageFormCopier);
268+
}
269+
270+
PdfAcroForm acroForm = PdfAcroForm.getAcroForm(destDoc, false);
271+
272+
acroForm.getField("text_1").setValue("Text 1!");
273+
274+
destDoc.close();
275+
srcDoc.close();
276+
277+
Assert.assertNull(new CompareTool().compareByContent(destFilename, sourceFolder + "cmp_copyMultipleSubfieldsTest03.pdf", destinationFolder, "diff_"));
278+
}
279+
195280
@Test
196281
@LogMessages(messages = {
197282
@LogMessage(messageTemplate = LogMessageConstant.DOCUMENT_ALREADY_HAS_FIELD, count = 13)
@@ -356,12 +441,38 @@ public void copyFieldsTest12() throws IOException, InterruptedException {
356441
Assert.assertNull(new CompareTool().compareByContent(destFilename, sourceFolder + "cmp_copyFields12.pdf", destinationFolder, "diff_"));
357442
}
358443

444+
@Test
445+
@LogMessages(messages = {
446+
@LogMessage(messageTemplate = LogMessageConstant.DOCUMENT_ALREADY_HAS_FIELD, count = 1)
447+
})
448+
public void copyFieldsTest13() throws IOException, InterruptedException {
449+
String srcFilename = sourceFolder + "copyFields13.pdf";
450+
String destFilename = destinationFolder + "copyFields13.pdf";
451+
452+
PdfDocument srcDoc = new PdfDocument(new PdfReader(srcFilename));
453+
PdfDocument destDoc = new PdfDocument(new PdfWriter(destFilename));
454+
455+
PdfPageFormCopier pdfPageFormCopier = new PdfPageFormCopier();
456+
457+
for (int i = 0; i < 1; ++i) {
458+
srcDoc.copyPagesTo(1, 1, destDoc, pdfPageFormCopier);
459+
}
460+
461+
PdfAcroForm acroForm = PdfAcroForm.getAcroForm(destDoc, false);
462+
463+
acroForm.getField("text").setValue("Text!");
464+
465+
destDoc.close();
466+
srcDoc.close();
467+
468+
Assert.assertNull(new CompareTool().compareByContent(destFilename, sourceFolder + "cmp_copyFields13.pdf", destinationFolder, "diff_"));
469+
}
359470

360471

361472
@Test
362473
public void copyPagesWithInheritedResources() throws IOException, InterruptedException {
363-
String sourceFile = sourceFolder +"AnnotationSampleStandard.pdf";
364-
String destFile = destinationFolder + "AnnotationSampleStandard_copy.pdf";
474+
String sourceFile = sourceFolder + "AnnotationSampleStandard.pdf";
475+
String destFile = destinationFolder + "AnnotationSampleStandard_copy.pdf";
365476
PdfDocument source = new PdfDocument(new PdfReader(sourceFile));
366477
PdfDocument target = new PdfDocument(new PdfWriter(destFile));
367478
target.initializeOutlines();

0 commit comments

Comments
 (0)