diff --git a/itext.tests/itext.layout.tests/itext/layout/PdfUA2AnnotationsTest.cs b/itext.tests/itext.layout.tests/itext/layout/PdfUA2AnnotationsTest.cs index 5c6a9ae1bc..f0ded8c74b 100644 --- a/itext.tests/itext.layout.tests/itext/layout/PdfUA2AnnotationsTest.cs +++ b/itext.tests/itext.layout.tests/itext/layout/PdfUA2AnnotationsTest.cs @@ -74,7 +74,8 @@ public virtual void PdfUA2LinkAnnotationsTest() { [NUnit.Framework.Test] public virtual void PdfUA2LinkAnnotNoAltTest() { - String outFile = DESTINATION_FOLDER + "pdfuaLinkAnnotationTest.pdf"; + String outFile = DESTINATION_FOLDER + "pdfuaLinkAnnotationNoAltTest.pdf"; + String cmpFile = SOURCE_FOLDER + "cmp_pdfuaLinkAnnotationNoAltTest.pdf"; using (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFile, new WriterProperties().SetPdfVersion (PdfVersion.PDF_2_0)))) { CreateSimplePdfUA2Document(pdfDocument); @@ -87,10 +88,9 @@ public virtual void PdfUA2LinkAnnotNoAltTest() { paragraph.Add(link); new Document(pdfDocument).Add(paragraph); } - new VeraPdfValidator().ValidateFailure(outFile); + CompareAndValidate(outFile, cmpFile); } - // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf\a validation on Android) [NUnit.Framework.Test] public virtual void PdfUA2FileAttachmentAnnotTest() { String outFile = DESTINATION_FOLDER + "pdfuaFileAttachmentAnnotTest.pdf"; @@ -154,6 +154,7 @@ public virtual void PdfUA2RubberStampAnnotationsTest() { [NUnit.Framework.Test] public virtual void PdfUA2RubberStampNoContentsAnnotationsTest() { String outFile = DESTINATION_FOLDER + "pdfuaRubberstampNoContentAnnotationTest.pdf"; + String cmpFile = SOURCE_FOLDER + "cmp_pdfuaRubberstampNoContentAnnotationTest.pdf"; using (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFile, new WriterProperties().SetPdfVersion (PdfVersion.PDF_2_0)))) { CreateSimplePdfUA2Document(pdfDocument); @@ -163,12 +164,12 @@ public virtual void PdfUA2RubberStampNoContentsAnnotationsTest() { pdfPage.AddAnnotation(stamp); pdfPage.Flush(); } - new VeraPdfValidator().ValidateFailure(outFile); + CompareAndValidate(outFile, cmpFile); } - // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf\a validation on Android) [NUnit.Framework.Test] public virtual void PdfUA2ScreenAnnotationsTest() { + //TODO DEVSIX-8807 Kernel: addAnnotation method doesn't annotate content elements with Annot tag when PDF version is 2.0 String outFile = DESTINATION_FOLDER + "pdfuaScreenAnnotationTest.pdf"; using (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFile, new WriterProperties().SetPdfVersion (PdfVersion.PDF_2_0)))) { @@ -179,7 +180,7 @@ public virtual void PdfUA2ScreenAnnotationsTest() { pdfPage.AddAnnotation(screen); pdfPage.Flush(); } - NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outFile)); + NUnit.Framework.Assert.IsNotNull(new VeraPdfValidator().Validate(outFile)); } // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf\a validation on Android) @@ -247,6 +248,7 @@ public virtual void PdfUA2RedactionAnnotationsTest() { [NUnit.Framework.Test] public virtual void PdfUA2RedactionNoContentsAnnotationsTest() { String outFile = DESTINATION_FOLDER + "pdfuaRedactionNoContentsAnnotationTest.pdf"; + String cmpFile = SOURCE_FOLDER + "cmp_pdfuaRedactionNoContentsAnnotationTest.pdf"; using (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFile, new WriterProperties().SetPdfVersion (PdfVersion.PDF_2_0)))) { CreateSimplePdfUA2Document(pdfDocument); @@ -256,14 +258,13 @@ public virtual void PdfUA2RedactionNoContentsAnnotationsTest() { pdfPage.AddAnnotation(redact); pdfPage.Flush(); } - new VeraPdfValidator().ValidateFailure(outFile); + CompareAndValidate(outFile, cmpFile); } - // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf\a validation on Android) [NUnit.Framework.Test] public virtual void PdfUA23DAnnotationsTest() { + //TODO DEVSIX-8807 Kernel: addAnnotation method doesn't annotate content elements with Annot tag when PDF version is 2.0 String outFile = DESTINATION_FOLDER + "pdfua3DAnnotationTest.pdf"; - String cmpFile = SOURCE_FOLDER + "cmp_pdfua3DAnnotationTest.pdf"; using (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFile, new WriterProperties().SetPdfVersion (PdfVersion.PDF_2_0)))) { CreateSimplePdfUA2Document(pdfDocument); @@ -272,9 +273,10 @@ public virtual void PdfUA23DAnnotationsTest() { pdfPage.AddAnnotation(annot); pdfPage.Flush(); } - CompareAndValidate(outFile, cmpFile); + new VeraPdfValidator().ValidateFailure(outFile); } + // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf\a validation on Android) [NUnit.Framework.Test] public virtual void PdfUA23DNoContentsAnnotationsTest() { String outFile = DESTINATION_FOLDER + "pdfua3DNoContentsAnnotationTest.pdf"; @@ -392,8 +394,8 @@ public virtual void PdfUA2AltContentDiffAnnotationTest() { // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf\a validation on Android) [NUnit.Framework.Test] public virtual void PdfUA2TabAnnotationsTest() { + //TODO DEVSIX-8807 Kernel: addAnnotation method doesn't annotate content elements with Annot tag when PDF version is 2.0 String outFile = DESTINATION_FOLDER + "pdfuaMultipleAnnotsTabAnnotationTest.pdf"; - String cmpFile = SOURCE_FOLDER + "cmp_pdfuaMultipleAnnotsTabAnnotationTest.pdf"; using (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFile, new WriterProperties().SetPdfVersion (PdfVersion.PDF_2_0)))) { CreateSimplePdfUA2Document(pdfDocument); @@ -409,9 +411,10 @@ public virtual void PdfUA2TabAnnotationsTest() { NUnit.Framework.Assert.AreEqual(PdfName.S, pageT); } } - CompareAndValidate(outFile, cmpFile); + new VeraPdfValidator().ValidateFailure(outFile); } + // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf\a validation on Android) [NUnit.Framework.Test] public virtual void AnnotationInvisibleButNoArtifactTest() { String outFile = DESTINATION_FOLDER + "pdfuaInvisibleAnnotationTest.pdf"; diff --git a/itext.tests/itext.layout.tests/itext/layout/PdfUA2Test.cs b/itext.tests/itext.layout.tests/itext/layout/PdfUA2Test.cs index 71fb4dc646..2e7ea6521a 100644 --- a/itext.tests/itext.layout.tests/itext/layout/PdfUA2Test.cs +++ b/itext.tests/itext.layout.tests/itext/layout/PdfUA2Test.cs @@ -224,6 +224,46 @@ public virtual void CheckSectionTest() { public virtual void CheckTableOfContentsTest() { String outFile = DESTINATION_FOLDER + "tableOfContentsTest.pdf"; String cmpFile = SOURCE_FOLDER + "cmp_tableOfContentsTestTest.pdf"; + using (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFile, new WriterProperties().SetPdfVersion + (PdfVersion.PDF_2_0)))) { + Document document = new Document(pdfDocument); + PdfFont font = PdfFontFactory.CreateFont(FONT_FOLDER + "FreeSans.ttf", "WinAnsi", PdfFontFactory.EmbeddingStrategy + .FORCE_EMBEDDED); + document.SetFont(font); + CreateSimplePdfUA2Document(pdfDocument); + Paragraph paragraph = new Paragraph("Table of Contents"); + document.Add(paragraph); + Paragraph tociRef = new Paragraph("The referenced paragraph"); + document.Add(tociRef); + TagTreePointer pointer = new TagTreePointer(pdfDocument); + pointer.MoveToKid(1, StandardRoles.P); + Div tocDiv = new Div(); + tocDiv.GetAccessibilityProperties().SetRole(StandardRoles.TOC).SetNamespace(new PdfNamespace(StandardNamespaces + .PDF_1_7)); + Div firstTociDiv = new Div(); + firstTociDiv.GetAccessibilityProperties().SetRole(StandardRoles.TOCI).SetNamespace(new PdfNamespace(StandardNamespaces + .PDF_1_7)); + firstTociDiv.Add(new Paragraph("first toci")); + firstTociDiv.GetAccessibilityProperties().AddRef(pointer); + Div secondTociDiv = new Div(); + secondTociDiv.GetAccessibilityProperties().SetRole(StandardRoles.TOCI).SetNamespace(new PdfNamespace(StandardNamespaces + .PDF_1_7)); + secondTociDiv.Add(new Paragraph("second toci")); + secondTociDiv.GetAccessibilityProperties().AddRef(pointer); + tocDiv.Add(firstTociDiv); + tocDiv.Add(secondTociDiv); + document.Add(tocDiv); + pointer.MoveToParent().MoveToKid(StandardRoles.TOCI); + // We check that TOCI contains the previously added Paragraph ref + NUnit.Framework.Assert.AreEqual(1, pointer.GetProperties().GetRefsList().Count); + NUnit.Framework.Assert.AreEqual(StandardRoles.P, pointer.GetProperties().GetRefsList()[0].GetRole()); + } + CompareAndValidate(outFile, cmpFile); + } + + [NUnit.Framework.Test] + public virtual void CheckInvalidStructureTableOfContentsTest() { + String outFile = DESTINATION_FOLDER + "invalidStructureTableOfContentsTest.pdf"; using (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFile, new WriterProperties().SetPdfVersion (PdfVersion.PDF_2_0)))) { Document document = new Document(pdfDocument); @@ -249,9 +289,11 @@ public virtual void CheckTableOfContentsTest() { NUnit.Framework.Assert.AreEqual(1, pointer.GetProperties().GetRefsList().Count); NUnit.Framework.Assert.AreEqual(StandardRoles.P, pointer.GetProperties().GetRefsList()[0].GetRole()); } - CompareAndValidate(outFile, cmpFile); + // We expect failing validation because TOC and TOCI shall not contain Span tags + new VeraPdfValidator().ValidateFailure(outFile); } + // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf\a validation on Android) [NUnit.Framework.Test] public virtual void CreateValidAsideTest() { String outFile = DESTINATION_FOLDER + "validAsideTest.pdf"; @@ -264,7 +306,34 @@ public virtual void CreateValidAsideTest() { document.SetFont(font); CreateSimplePdfUA2Document(pdfDocument); document.Add(new Paragraph("Section 1:")); - Paragraph section1Content = new Paragraph("Paragraph 1.1"); + document.Add(new Paragraph("Paragraph 1.1")); + Div aside = new Div(); + aside.GetAccessibilityProperties().SetRole(StandardRoles.ASIDE); + aside.Add(new Paragraph("Additional content related to Section 1.")); + document.Add(aside); + document.Add(new Paragraph("Section 2:")); + document.Add(new Paragraph("Paragraph 2.1")); + document.Add(new Paragraph("Paragraph 2.2")); + Div aside2 = new Div(); + aside2.GetAccessibilityProperties().SetRole(StandardRoles.ASIDE); + aside2.Add(new Paragraph("Additional content related to Section 2.")); + document.Add(aside2); + } + CompareAndValidate(outFile, cmpFile); + } + + [NUnit.Framework.Test] + public virtual void CreateInvalidAsideStructureTest() { + String outFile = DESTINATION_FOLDER + "invalidAsideStructureTest.pdf"; + using (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFile, new WriterProperties().SetPdfVersion + (PdfVersion.PDF_2_0)))) { + Document document = new Document(pdfDocument); + PdfFont font = PdfFontFactory.CreateFont(FONT_FOLDER + "FreeSans.ttf", "WinAnsi", PdfFontFactory.EmbeddingStrategy + .FORCE_EMBEDDED); + document.SetFont(font); + CreateSimplePdfUA2Document(pdfDocument); + document.Add(new Paragraph("Section 1:")); + Paragraph section1Content = new Paragraph("Paragraph 1.1\n"); Paragraph aside = new Paragraph("Additional content related to Section 1."); aside.GetAccessibilityProperties().SetRole(StandardRoles.ASIDE); section1Content.Add(aside); @@ -275,11 +344,12 @@ public virtual void CreateValidAsideTest() { Paragraph aside2 = new Paragraph("Additional content related to Section 2."); aside2.GetAccessibilityProperties().SetRole(StandardRoles.ASIDE); document.Add(aside2); - document.Add(new Paragraph("Section 3:")); } - CompareAndValidate(outFile, cmpFile); + // We expect failing validation because Aside shall not contain Span and P shall not contain Aside + new VeraPdfValidator().ValidateFailure(outFile); } + // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf\a validation on Android) [NUnit.Framework.Test] public virtual void CheckParagraphTest() { String outFile = DESTINATION_FOLDER + "paragraphTest.pdf"; @@ -332,9 +402,32 @@ public virtual void CheckHeadingTest() { } [NUnit.Framework.Test] - public virtual void CheckLabelTest() { + public virtual void CheckLabelInListTest() { + String outFile = DESTINATION_FOLDER + "labelInListTest.pdf"; + String cmpFile = SOURCE_FOLDER + "cmp_labelInListTest.pdf"; + using (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFile, new WriterProperties().SetPdfVersion + (PdfVersion.PDF_2_0)))) { + Document document = new Document(pdfDocument); + PdfFont font = PdfFontFactory.CreateFont(FONT_FOLDER + "FreeSans.ttf", "WinAnsi", PdfFontFactory.EmbeddingStrategy + .FORCE_EMBEDDED); + document.SetFont(font); + CreateSimplePdfUA2Document(pdfDocument); + List list = new List(); + list.Add("First list element"); + list.Add("Second list element"); + list.Add("Third list element"); + document.Add(list); + TagTreePointer pointer = new TagTreePointer(pdfDocument); + pointer.MoveToKid(StandardRoles.LI); + // We check that a list element contains a bullet with Lbl tag + NUnit.Framework.Assert.AreEqual(StandardRoles.LBL, pointer.GetKidsRoles()[0]); + } + CompareAndValidate(outFile, cmpFile); + } + + [NUnit.Framework.Test] + public virtual void CheckInvalidLabelStructureTest() { String outFile = DESTINATION_FOLDER + "labelTest.pdf"; - String cmpFile = SOURCE_FOLDER + "cmp_labelTest.pdf"; using (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFile, new WriterProperties().SetPdfVersion (PdfVersion.PDF_2_0)))) { Document document = new Document(pdfDocument); @@ -344,12 +437,34 @@ public virtual void CheckLabelTest() { CreateSimplePdfUA2Document(pdfDocument); Div lblStructure = new Div(); lblStructure.GetAccessibilityProperties().SetRole(StandardRoles.LBL); - Paragraph labelContent = new Paragraph("Label: "); + Paragraph labelContent = new Paragraph("Label content"); lblStructure.Add(labelContent); - Paragraph targetContent = new Paragraph("Marked content"); - targetContent.GetAccessibilityProperties().SetActualText("Marked content"); document.Add(lblStructure); - document.Add(targetContent); + } + // We expect failing validation because Lbl shall not contain P and Document shall not contain Lbl + new VeraPdfValidator().ValidateFailure(outFile); + } + + // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf\a validation on Android) + [NUnit.Framework.Test] + public virtual void CheckLabelWithLinkContentTest() { + String outFile = DESTINATION_FOLDER + "labelWithLinkContentTest.pdf"; + String cmpFile = SOURCE_FOLDER + "cmp_labelWithLinkContentTest.pdf"; + using (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFile, new WriterProperties().SetPdfVersion + (PdfVersion.PDF_2_0)))) { + Document document = new Document(pdfDocument); + PdfFont font = PdfFontFactory.CreateFont(FONT_FOLDER + "FreeSans.ttf", "WinAnsi", PdfFontFactory.EmbeddingStrategy + .FORCE_EMBEDDED); + document.SetFont(font); + CreateSimplePdfUA2Document(pdfDocument); + Paragraph container = new Paragraph(); + Div lblStructure = new Div(); + lblStructure.GetAccessibilityProperties().SetRole(StandardRoles.LBL); + Paragraph labelContent = new Paragraph("Label with Link content"); + labelContent.GetAccessibilityProperties().SetRole(StandardRoles.LINK); + lblStructure.Add(labelContent); + container.Add(lblStructure); + document.Add(container); } CompareAndValidate(outFile, cmpFile); } @@ -554,6 +669,26 @@ public virtual void CheckFormulaTest() { public virtual void CheckBibliographicEntryTest() { String outFile = DESTINATION_FOLDER + "bibliographicEntryTest.pdf"; String cmpFile = SOURCE_FOLDER + "cmp_bibliographicEntryTest.pdf"; + using (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFile, new WriterProperties().SetPdfVersion + (PdfVersion.PDF_2_0)))) { + Document document = new Document(pdfDocument); + PdfFont font = PdfFontFactory.CreateFont(FONT_FOLDER + "FreeSans.ttf", "WinAnsi", PdfFontFactory.EmbeddingStrategy + .FORCE_EMBEDDED); + document.SetFont(font); + CreateSimplePdfUA2Document(pdfDocument); + Paragraph paragraph = new Paragraph("Bibliography paragraph:\n"); + Paragraph bibliography = new Paragraph("1. Author A. Title of Book. Publisher, Year."); + bibliography.GetAccessibilityProperties().SetRole(StandardRoles.BIBENTRY).SetNamespace(new PdfNamespace(StandardNamespaces + .PDF_1_7)); + paragraph.Add(bibliography); + document.Add(paragraph); + } + CompareAndValidate(outFile, cmpFile); + } + + [NUnit.Framework.Test] + public virtual void CheckInvalidBibliographicStructureEntryTest() { + String outFile = DESTINATION_FOLDER + "invalidBibliographicStructureEntryTest.pdf"; using (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFile, new WriterProperties().SetPdfVersion (PdfVersion.PDF_2_0)))) { Document document = new Document(pdfDocument); @@ -569,9 +704,11 @@ public virtual void CheckBibliographicEntryTest() { section.Add(bibliography); document.Add(section); } - CompareAndValidate(outFile, cmpFile); + // We expect failing validation because Sect shall not contain BibEntry and Span + new VeraPdfValidator().ValidateFailure(outFile); } + // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf\a validation on Android) [NUnit.Framework.Test] public virtual void CheckMetadataNoTitleTest() { String outFile = DESTINATION_FOLDER + "pdfuaMetadataNoTitleTest.pdf"; diff --git a/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2AnnotationsTest/cmp_pdfuaLinkAnnotationNoAltTest.pdf b/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2AnnotationsTest/cmp_pdfuaLinkAnnotationNoAltTest.pdf new file mode 100644 index 0000000000..2ec81957cb Binary files /dev/null and b/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2AnnotationsTest/cmp_pdfuaLinkAnnotationNoAltTest.pdf differ diff --git a/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2AnnotationsTest/cmp_pdfua3DAnnotationTest.pdf b/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2AnnotationsTest/cmp_pdfuaRedactionNoContentsAnnotationTest.pdf similarity index 69% rename from itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2AnnotationsTest/cmp_pdfua3DAnnotationTest.pdf rename to itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2AnnotationsTest/cmp_pdfuaRedactionNoContentsAnnotationTest.pdf index 418496b363..cbe30e68a3 100644 Binary files a/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2AnnotationsTest/cmp_pdfua3DAnnotationTest.pdf and b/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2AnnotationsTest/cmp_pdfuaRedactionNoContentsAnnotationTest.pdf differ diff --git a/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2AnnotationsTest/cmp_pdfuaMultipleAnnotsTabAnnotationTest.pdf b/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2AnnotationsTest/cmp_pdfuaRubberstampNoContentAnnotationTest.pdf similarity index 62% rename from itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2AnnotationsTest/cmp_pdfuaMultipleAnnotsTabAnnotationTest.pdf rename to itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2AnnotationsTest/cmp_pdfuaRubberstampNoContentAnnotationTest.pdf index f4e1269cab..0558d09fe7 100644 Binary files a/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2AnnotationsTest/cmp_pdfuaMultipleAnnotsTabAnnotationTest.pdf and b/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2AnnotationsTest/cmp_pdfuaRubberstampNoContentAnnotationTest.pdf differ diff --git a/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_bibliographicEntryTest.pdf b/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_bibliographicEntryTest.pdf index 219f0bb476..a0f96bfc67 100644 Binary files a/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_bibliographicEntryTest.pdf and b/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_bibliographicEntryTest.pdf differ diff --git a/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_labelInListTest.pdf b/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_labelInListTest.pdf new file mode 100644 index 0000000000..e01c52d18d Binary files /dev/null and b/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_labelInListTest.pdf differ diff --git a/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_labelTest.pdf b/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_labelTest.pdf deleted file mode 100644 index 2ec1e6eb9e..0000000000 Binary files a/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_labelTest.pdf and /dev/null differ diff --git a/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_labelWithLinkContentTest.pdf b/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_labelWithLinkContentTest.pdf new file mode 100644 index 0000000000..6794f1068a Binary files /dev/null and b/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_labelWithLinkContentTest.pdf differ diff --git a/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_tableOfContentsTestTest.pdf b/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_tableOfContentsTestTest.pdf index 0d3a1c4b78..22dabaacea 100644 Binary files a/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_tableOfContentsTestTest.pdf and b/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_tableOfContentsTestTest.pdf differ diff --git a/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_validAsideTest.pdf b/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_validAsideTest.pdf index 05940b8a7f..b64a8ff082 100644 Binary files a/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_validAsideTest.pdf and b/itext.tests/itext.layout.tests/resources/itext/layout/PdfUA2Test/cmp_validAsideTest.pdf differ diff --git a/itext.tests/itext.pdfua.tests/itext/pdfua/PdfUAAnnotationsTest.cs b/itext.tests/itext.pdfua.tests/itext/pdfua/PdfUAAnnotationsTest.cs index 0271fcb847..2566856d0a 100644 --- a/itext.tests/itext.pdfua.tests/itext/pdfua/PdfUAAnnotationsTest.cs +++ b/itext.tests/itext.pdfua.tests/itext/pdfua/PdfUAAnnotationsTest.cs @@ -739,28 +739,30 @@ public virtual void Ua1PrinterMAnnotIsInLogicalStructureTest() { [NUnit.Framework.Test] public virtual void Ua1PrinterMAnnotNotInTagStructureTest() { - String outPdf = DESTINATION_FOLDER + "ua1PrinterMAnnotNotInTagStructureTest.pdf"; - PdfDocument pdfDoc = new PdfUATestPdfDocument(new PdfWriter(outPdf)); - PdfPage pdfPage = pdfDoc.AddNewPage(); - PdfFormXObject form = new PdfFormXObject(PageSize.A4); - PdfCanvas canvas = new PdfCanvas(form, pdfDoc); - canvas.SaveState().Circle(265, 795, 5).SetColor(ColorConstants.GREEN, true).Fill().RestoreState(); - canvas.Release(); - PdfPrinterMarkAnnotation annot = new PdfPrinterMarkAnnotation(PageSize.A4, form); - annot.SetContents("link annot"); - // Put false as 3rd parameter to not tag annotation - pdfPage.AddAnnotation(-1, annot, false); - PdfUAAnnotationsTest.PdfCustomAnnot annot2 = new PdfUAAnnotationsTest.PdfCustomAnnot(new Rectangle(100, 650 - , 400, 100)); - annot2.SetContents("Content of unique annot"); - pdfPage.AddAnnotation(annot2); - NUnit.Framework.Assert.DoesNotThrow(() => pdfDoc.Close()); - // VeraPdf complains about the fact that PrinterMark annotation isn't wrapped by Annot tag. - // But in that test we don't put PrinterMark annot in tag structure at all. - new VeraPdfValidator().ValidateFailure(outPdf); + framework.AddBeforeGenerationHook((pdfDoc) => { + PdfPage pdfPage = pdfDoc.AddNewPage(); + PdfFormXObject form = new PdfFormXObject(PageSize.A4); + PdfCanvas canvas = new PdfCanvas(form, pdfDoc); + canvas.SaveState().Circle(265, 795, 5).SetColor(ColorConstants.GREEN, true).Fill().RestoreState(); + canvas.Release(); + PdfPrinterMarkAnnotation annot = new PdfPrinterMarkAnnotation(PageSize.A4, form); + annot.SetContents("link annot"); + // Put false as 3rd parameter to not tag annotation + pdfPage.AddAnnotation(-1, annot, false); + PdfUAAnnotationsTest.PdfCustomAnnot annot2 = new PdfUAAnnotationsTest.PdfCustomAnnot(new Rectangle(100, 650 + , 400, 100)); + annot2.SetContents("Content of unique annot"); + pdfPage.AddAnnotation(annot2); + PdfStampAnnotation stamp = new PdfStampAnnotation(new Rectangle(0, 0, 100, 50)); + stamp.SetStampName(PdfName.Approved); + stamp.SetContents("stamp contents"); + stamp.GetPdfObject().Put(PdfName.Type, PdfName.Annot); + pdfPage.AddAnnotation(stamp); + } + ); + framework.AssertBothValid("ua1PrinterMAnnotNotInTagStructureTest"); } - // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) private PdfTextAnnotation CreateRichTextAnnotation() { PdfTextAnnotation annot = new PdfTextAnnotation(new Rectangle(100, 100, 100, 100)); annot.SetContents("Rich media annot"); diff --git a/itext/itext.pdftest/itext-pdftest.nuspec b/itext/itext.pdftest/itext-pdftest.nuspec index 92b8355feb..5273edd27e 100644 --- a/itext/itext.pdftest/itext-pdftest.nuspec +++ b/itext/itext.pdftest/itext-pdftest.nuspec @@ -23,7 +23,7 @@ - + diff --git a/itext/itext.pdftest/itext.pdftest.csproj b/itext/itext.pdftest/itext.pdftest.csproj index 3062a52642..17fa041909 100644 --- a/itext/itext.pdftest/itext.pdftest.csproj +++ b/itext/itext.pdftest/itext.pdftest.csproj @@ -47,7 +47,7 @@ - + PreserveNewest diff --git a/itext/itext.pdftest/itext.pdftest.props b/itext/itext.pdftest/itext.pdftest.props index e7fe38d5a2..81e7a27a6f 100644 --- a/itext/itext.pdftest/itext.pdftest.props +++ b/itext/itext.pdftest/itext.pdftest.props @@ -1,8 +1,8 @@ - - lib\verapdf\greenfield-apps-1.25.116.jar + + lib\verapdf\greenfield-apps-1.26.2.jar Always diff --git a/itext/itext.pdftest/lib/verapdf/greenfield-apps-1.25.116.jar b/itext/itext.pdftest/lib/verapdf/greenfield-apps-1.26.2.jar similarity index 83% rename from itext/itext.pdftest/lib/verapdf/greenfield-apps-1.25.116.jar rename to itext/itext.pdftest/lib/verapdf/greenfield-apps-1.26.2.jar index 1440486132..9c5b6b08a9 100644 Binary files a/itext/itext.pdftest/lib/verapdf/greenfield-apps-1.25.116.jar and b/itext/itext.pdftest/lib/verapdf/greenfield-apps-1.26.2.jar differ diff --git a/port-hash b/port-hash index 45644bb10c..d3d4ff447d 100644 --- a/port-hash +++ b/port-hash @@ -1 +1 @@ -81e947664c0e8cd96bb236ddbfb88205bdcc0243 +c41c5463f9c1c2f692e5e2e5259d07122440bfc3