diff --git a/itext.tests/itext.pdfa.tests/itext/pdfa/PdfA4GraphicsCheckTest.cs b/itext.tests/itext.pdfa.tests/itext/pdfa/PdfA4GraphicsCheckTest.cs index caf8b538a0..2810eefbca 100644 --- a/itext.tests/itext.pdfa.tests/itext/pdfa/PdfA4GraphicsCheckTest.cs +++ b/itext.tests/itext.pdfa.tests/itext/pdfa/PdfA4GraphicsCheckTest.cs @@ -936,6 +936,44 @@ public virtual void ImageTest() { CompareResult(outPdf, cmpPdf); } + [NUnit.Framework.Test] + public virtual void ImageJpeg20002ColorChannelsTest() { + String outPdf = DESTINATION_FOLDER + "pdfA4_jpeg2000.pdf"; + PdfDocument pdfDoc = new PdfADocument(new PdfWriter(outPdf, new WriterProperties().SetPdfVersion(PdfVersion + .PDF_2_0)), PdfAConformanceLevel.PDF_A_4, null); + PdfPage page = pdfDoc.AddNewPage(); + // This should suppress transparency and device RGB + page.AddOutputIntent(new PdfOutputIntent("Custom", "", "http://www.color.org", "sRGB IEC61966-2.1", new FileStream + (SOURCE_FOLDER + "sRGB Color Space Profile.icm", FileMode.Open, FileAccess.Read))); + PdfCanvas canvas = new PdfCanvas(page); + canvas.SaveState(); + canvas.AddImageFittedIntoRectangle(ImageDataFactory.Create(SOURCE_FOLDER + "jpeg2000/bee2colorchannels.jp2" + ), new Rectangle(0, 0, page.GetPageSize().GetWidth() / 2, page.GetPageSize().GetHeight() / 2), false); + canvas.RestoreState(); + Exception e = NUnit.Framework.Assert.Catch(typeof(PdfAConformanceException), () => pdfDoc.Close()); + NUnit.Framework.Assert.AreEqual(PdfaExceptionMessageConstant.THE_NUMBER_OF_COLOUR_CHANNELS_IN_THE_JPEG2000_DATA_SHALL_BE_1_3_OR_4 + , e.Message); + } + + [NUnit.Framework.Test] + public virtual void ImageJpeg2000Test() { + String outPdf = DESTINATION_FOLDER + "pdfA4_jpeg2000.pdf"; + String cmpPdf = CMP_FOLDER + "cmp_pdfA4_jpeg2000.pdf"; + PdfDocument pdfDoc = new PdfADocument(new PdfWriter(outPdf, new WriterProperties().SetPdfVersion(PdfVersion + .PDF_2_0)), PdfAConformanceLevel.PDF_A_4, null); + PdfPage page = pdfDoc.AddNewPage(); + // This should suppress transparency and device RGB + page.AddOutputIntent(new PdfOutputIntent("Custom", "", "http://www.color.org", "sRGB IEC61966-2.1", new FileStream + (SOURCE_FOLDER + "sRGB Color Space Profile.icm", FileMode.Open, FileAccess.Read))); + PdfCanvas canvas = new PdfCanvas(page); + canvas.SaveState(); + canvas.AddImageFittedIntoRectangle(ImageDataFactory.Create(SOURCE_FOLDER + "jpeg2000/bee.jp2"), new Rectangle + (0, 0, page.GetPageSize().GetWidth() / 2, page.GetPageSize().GetHeight() / 2), false); + canvas.RestoreState(); + pdfDoc.Close(); + CompareResult(outPdf, cmpPdf); + } + [NUnit.Framework.Test] public virtual void PdfA4AnnotationsNoOutputIntentTest() { String outPdf = DESTINATION_FOLDER + "pdfA4AnnotationsNoOutputIntent.pdf"; diff --git a/itext.tests/itext.pdfa.tests/resources/itext/pdfa/cmp/PdfA4GraphicsCheckTest/cmp_pdfA4_jpeg2000.pdf b/itext.tests/itext.pdfa.tests/resources/itext/pdfa/cmp/PdfA4GraphicsCheckTest/cmp_pdfA4_jpeg2000.pdf new file mode 100644 index 0000000000..fb820e3be5 Binary files /dev/null and b/itext.tests/itext.pdfa.tests/resources/itext/pdfa/cmp/PdfA4GraphicsCheckTest/cmp_pdfA4_jpeg2000.pdf differ diff --git a/itext.tests/itext.pdfa.tests/resources/itext/pdfa/jpeg2000/CC0-1.0.txt b/itext.tests/itext.pdfa.tests/resources/itext/pdfa/jpeg2000/CC0-1.0.txt new file mode 100644 index 0000000000..af469a0034 --- /dev/null +++ b/itext.tests/itext.pdfa.tests/resources/itext/pdfa/jpeg2000/CC0-1.0.txt @@ -0,0 +1,29 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + +CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following: +i. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work; +ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work; +iv. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below; +v. rights protecting the extraction, dissemination, use and reuse of data in a Work; +vi. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and +vii. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof. +2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose. +3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose. +4. Limitations and Disclaimers. +a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document. +b. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law. +c. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work. +d. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work. \ No newline at end of file diff --git a/itext.tests/itext.pdfa.tests/resources/itext/pdfa/jpeg2000/NOTICE.txt b/itext.tests/itext.pdfa.tests/resources/itext/pdfa/jpeg2000/NOTICE.txt index e474c3e4c5..3829f78aba 100644 --- a/itext.tests/itext.pdfa.tests/resources/itext/pdfa/jpeg2000/NOTICE.txt +++ b/itext.tests/itext.pdfa.tests/resources/itext/pdfa/jpeg2000/NOTICE.txt @@ -11,4 +11,7 @@ This software uses the following test resources under the following licenses: | p0_01.j2k | (2023/07/25) cpyrght.htm | | p0_02.j2k | (2023/07/25) cpyrght.htm | | p1_01.j2k | (2023/07/25) cpyrght.htm | -| p1_02.j2k | (2023/07/25) cpyrght.htm | \ No newline at end of file +| p1_02.j2k | (2023/07/25) cpyrght.htm | +| bee.jp2 | CC0-1.0 | CC0-1.0.txt | (2023/10/10) https://unsplash.com/photos/tuQGZ6U7P2A +| bee2colorchannels.jp2 | CC0-1.0 | CC0-1.0.txt | (2023/10/10) https://unsplash.com/photos/tuQGZ6U7P2A + diff --git a/itext.tests/itext.pdfa.tests/resources/itext/pdfa/jpeg2000/bee.jp2 b/itext.tests/itext.pdfa.tests/resources/itext/pdfa/jpeg2000/bee.jp2 new file mode 100644 index 0000000000..09d7b1ea98 Binary files /dev/null and b/itext.tests/itext.pdfa.tests/resources/itext/pdfa/jpeg2000/bee.jp2 differ diff --git a/itext.tests/itext.pdfa.tests/resources/itext/pdfa/jpeg2000/bee2colorchannels.jp2 b/itext.tests/itext.pdfa.tests/resources/itext/pdfa/jpeg2000/bee2colorchannels.jp2 new file mode 100644 index 0000000000..198a20bbd5 Binary files /dev/null and b/itext.tests/itext.pdfa.tests/resources/itext/pdfa/jpeg2000/bee2colorchannels.jp2 differ diff --git a/itext.tests/itext.pdfua.tests/itext/pdfua/PdfUACanvasTest.cs b/itext.tests/itext.pdfua.tests/itext/pdfua/PdfUACanvasTest.cs index c15a3e01e5..e8344cbee0 100644 --- a/itext.tests/itext.pdfua.tests/itext/pdfua/PdfUACanvasTest.cs +++ b/itext.tests/itext.pdfua.tests/itext/pdfua/PdfUACanvasTest.cs @@ -39,6 +39,7 @@ You should have received a copy of the GNU Affero General Public License using iText.Test.Pdfa; namespace iText.Pdfua { + // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) [NUnit.Framework.Category("UnitTest")] public class PdfUACanvasTest : ExtendedITextTest { private static readonly String FONT = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext @@ -84,7 +85,7 @@ public virtual void CheckPoint_01_005_TextContentIsCorrectlyTaggedAsContent() { pdfDoc.Close(); NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, SOURCE_FOLDER + "cmp_01_005_TextContentIsCorrectlyTaggedAsContent.pdf" , DESTINATION_FOLDER, "diff_")); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); } // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) @@ -121,7 +122,7 @@ public virtual void CheckPoint_01_005_TextArtifactIsNotInTagTree() { pdfDoc.Close(); NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, SOURCE_FOLDER + "cmp_01_005_TextArtifactIsNotInTagTree.pdf" , DESTINATION_FOLDER, "diff_")); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); } // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) @@ -177,7 +178,7 @@ public virtual void CheckPoint_01_005_TextGlyphLineContentIsArtifact() { pdfDoc.Close(); NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, SOURCE_FOLDER + "cmp_01_005_TextGlyphLineContentIsArtifact.pdf" , DESTINATION_FOLDER, "diff_")); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); } // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) @@ -197,7 +198,7 @@ public virtual void CheckPoint_01_005_TextGlyphLineContentIsContentCorrect() { pdfDoc.Close(); NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, SOURCE_FOLDER + "cmp_01_005_TextGlyphLineContentIsContentCorrect.pdf" , DESTINATION_FOLDER, "diff_")); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); } // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) @@ -216,7 +217,7 @@ public virtual void CheckPoint_01_005_allowPureBmcInArtifact() { pdfDoc.Close(); NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, SOURCE_FOLDER + "cmp_01_005_allowPureBmcInArtifact.pdf" , DESTINATION_FOLDER, "diff_")); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); } // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) @@ -235,7 +236,7 @@ public virtual void CheckPoint_01_005_allowNestedPureBmcInArtifact() { pdfDoc.Close(); NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, SOURCE_FOLDER + "cmp_01_005_allowNestedPureBmcInArtifact.pdf" , DESTINATION_FOLDER, "diff_")); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); } // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) @@ -280,7 +281,7 @@ public virtual void CheckPoint_01_005_LineContentThatIsMarkedAsArtifact() { pdfDoc.Close(); NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, SOURCE_FOLDER + "cmp_01_005_LineContentThatIsMarkedAsArtifact.pdf" , DESTINATION_FOLDER, "diff_")); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); } // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) @@ -309,7 +310,7 @@ public virtual void CheckPoint_01_005_RectangleMarkedArtifact() { pdfDoc.Close(); NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, SOURCE_FOLDER + "cmp_01_005_RectangleMarkedArtifact.pdf" , DESTINATION_FOLDER, "diff_")); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); } // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) @@ -341,7 +342,7 @@ public virtual void CheckPoint_01_005_RectangleMarkedContent() { pdfDoc.Close(); NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, SOURCE_FOLDER + "cmp_01_005_RectangleMarkedContent.pdf" , DESTINATION_FOLDER, "diff_")); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); } // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) @@ -357,7 +358,7 @@ public virtual void CheckPoint_01_004_bezierMarkedAsContent() { ).SetStrokeColor(ColorConstants.RED).Arc(400, 400, 500, 500, 30, 50).Stroke().CloseTag().RestoreState( ); pdfDoc.Close(); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, SOURCE_FOLDER + "cmp_01_004_bezierCurveShouldBeTagged.pdf" , DESTINATION_FOLDER, "diff_")); @@ -373,7 +374,7 @@ public virtual void CheckPoint_01_004_bezierMarkedAsArtifact() { (5).SetStrokeColor(ColorConstants.RED).Arc(400, 400, 500, 500, 30, 50).Stroke().CloseTag().RestoreState (); pdfDoc.Close(); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, SOURCE_FOLDER + "cmp_01_004_bezierMarkedAsArtifact.pdf" , DESTINATION_FOLDER, "diff_")); @@ -405,7 +406,7 @@ public virtual void CheckPoint_01_005_RandomOperationsWithoutActuallyAddingConte pdfDoc.Close(); NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, SOURCE_FOLDER + "cmp_01_005_RandomOperationsWithoutActuallyAddingContent.pdf" , DESTINATION_FOLDER, "diff_")); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); } // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) @@ -448,7 +449,7 @@ public virtual void CheckPoint_validRoleAddedInsideMarkedContent() { pdfDoc.Close(); NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, SOURCE_FOLDER + "cmp_validRoleAddedInsideMarkedContent.pdf" , DESTINATION_FOLDER, "diff_")); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); } // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) @@ -469,7 +470,7 @@ public virtual void CheckPoint_validRoleAddedInsideMarkedContentMultiple() { , 12).MoveText(200, 200).ShowText("Hello World!").EndText().EndMarkedContent().BeginMarkedContent(PdfName .H1).BeginText().ShowText("Hello but nested").EndText().EndMarkedContent().RestoreState().CloseTag(); pdfDoc.Close(); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, SOURCE_FOLDER + "cmp_validRoleAddedInsideMarkedContentMultiple.pdf" , DESTINATION_FOLDER, "diff_")); @@ -494,7 +495,7 @@ public virtual void CheckPoint_validRoleAddedInsideMarkedContentMCR_IN_MCR() { )).BeginMarkedContent(PdfName.H1).BeginText().ShowText("Hello but nested").EndText().EndMarkedContent( ).CloseTag().RestoreState().CloseTag(); pdfDoc.Close(); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, SOURCE_FOLDER + "cmp_validRoleAddedInsideMarkedContentMCR_IN_MCR.pdf" , DESTINATION_FOLDER, "diff_")); diff --git a/itext.tests/itext.pdfua.tests/itext/pdfua/PdfUALayoutTest.cs b/itext.tests/itext.pdfua.tests/itext/pdfua/PdfUALayoutTest.cs index f496d10de6..e1a85f0845 100644 --- a/itext.tests/itext.pdfua.tests/itext/pdfua/PdfUALayoutTest.cs +++ b/itext.tests/itext.pdfua.tests/itext/pdfua/PdfUALayoutTest.cs @@ -35,6 +35,7 @@ You should have received a copy of the GNU Affero General Public License using iText.Test.Pdfa; namespace iText.Pdfua { + // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) [NUnit.Framework.Category("IntegrationTest")] public class PdfUALayoutTest : ExtendedITextTest { private static readonly String DESTINATION_FOLDER = NUnit.Framework.TestContext.CurrentContext.TestDirectory @@ -64,7 +65,7 @@ public virtual void SimpleParagraphTest() { doc.Close(); NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, DESTINATION_FOLDER, "diff_" )); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); } // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) @@ -82,7 +83,7 @@ public virtual void SimpleBorderTest() { } NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, DESTINATION_FOLDER, "diff" )); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); } // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) @@ -101,7 +102,7 @@ public virtual void SimpleTableTest() { doc.Close(); NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, DESTINATION_FOLDER, "diff_" )); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); } // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) } diff --git a/itext.tests/itext.pdfua.tests/itext/pdfua/PdfUARoleMappingTest.cs b/itext.tests/itext.pdfua.tests/itext/pdfua/PdfUARoleMappingTest.cs index d037fe3ccd..1a411d5e14 100644 --- a/itext.tests/itext.pdfua.tests/itext/pdfua/PdfUARoleMappingTest.cs +++ b/itext.tests/itext.pdfua.tests/itext/pdfua/PdfUARoleMappingTest.cs @@ -36,6 +36,7 @@ You should have received a copy of the GNU Affero General Public License using iText.Test.Pdfa; namespace iText.Pdfua { + // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) [NUnit.Framework.Category("IntegrationTest")] public class PdfUARoleMappingTest : ExtendedITextTest { private static readonly String FONT = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext @@ -145,7 +146,7 @@ public virtual void StandardMappingViaTagTreePointer_02_001_Test() { pdfDoc.Close(); NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, DESTINATION_FOLDER, "diff_" )); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); } // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) diff --git a/itext.tests/itext.pdfua.tests/itext/pdfua/PdfUATest.cs b/itext.tests/itext.pdfua.tests/itext/pdfua/PdfUATest.cs index 12b7e2651c..056a436859 100644 --- a/itext.tests/itext.pdfua.tests/itext/pdfua/PdfUATest.cs +++ b/itext.tests/itext.pdfua.tests/itext/pdfua/PdfUATest.cs @@ -35,6 +35,7 @@ You should have received a copy of the GNU Affero General Public License using iText.Test.Pdfa; namespace iText.Pdfua { + // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) [NUnit.Framework.Category("IntegrationTest")] public class PdfUATest : ExtendedITextTest { private static readonly String DESTINATION_FOLDER = NUnit.Framework.TestContext.CurrentContext.TestDirectory @@ -95,7 +96,7 @@ public virtual void EmptyPageDocument() { } NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, SOURCE_FOLDER + "cmp_emptyPageDocument.pdf" , DESTINATION_FOLDER, "diff_")); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); } // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) @@ -148,7 +149,7 @@ public virtual void ManualPdfUaCreation() { document.Close(); NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, SOURCE_FOLDER + "cmp_manualPdfUaCreation.pdf" , DESTINATION_FOLDER, "diff_")); - NUnit.Framework.Assert.IsNull(new UAVeraPdfValidator().Validate(outPdf)); + NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(outPdf)); } // Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf/ua validation on Android) } diff --git a/itext/itext.pdftest/itext/test/pdfa/UAVeraPdfValidator.cs b/itext/itext.pdftest/itext/test/pdfa/UAVeraPdfValidator.cs deleted file mode 100644 index 9f3a27890e..0000000000 --- a/itext/itext.pdftest/itext/test/pdfa/UAVeraPdfValidator.cs +++ /dev/null @@ -1,28 +0,0 @@ -/* - This file is part of the iText (R) project. - Copyright (c) 1998-2023 Apryse Group NV - Authors: Apryse Software. - - This program is offered under a commercial and under the AGPL license. - For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. - - AGPL licensing: - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - */ - -namespace iText.Test.Pdfa { - public class UAVeraPdfValidator : VeraPdfValidator { - - } -} \ No newline at end of file diff --git a/itext/itext.sign/itext/signatures/LtvVerification.cs b/itext/itext.sign/itext/signatures/LtvVerification.cs index cb92ee2d23..640e15a299 100644 --- a/itext/itext.sign/itext/signatures/LtvVerification.cs +++ b/itext/itext.sign/itext/signatures/LtvVerification.cs @@ -427,14 +427,7 @@ private PdfName GetSignatureHashKey(String signatureName) { PdfSignature sig = sgnUtil.GetSignature(signatureName); PdfString contents = sig.GetContents(); byte[] bc = PdfEncodings.ConvertToBytes(contents.GetValue(), null); - byte[] bt = null; - if (PdfName.ETSI_RFC3161.Equals(sig.GetSubFilter())) { - using (IAsn1InputStream din = BOUNCY_CASTLE_FACTORY.CreateASN1InputStream(new MemoryStream(bc))) { - IAsn1Object pkcs = din.ReadObject(); - bc = pkcs.GetEncoded(); - } - } - bt = HashBytesSha1(bc); + byte[] bt = HashBytesSha1(bc); return new PdfName(ConvertToHex(bt)); } diff --git a/port-hash b/port-hash index 4f552e4f8b..1bbbc24ab4 100644 --- a/port-hash +++ b/port-hash @@ -1 +1 @@ -b51c25ba7752003b9c0fed59d223e4865e643e90 +08a48fa84a99696e352373caeaf7d8809ccf8b5c