Skip to content

Commit 2deec7b

Browse files
ar3emiText-CI
authored andcommitted
Remove invalid determinig of transparency on the page
Following the methods for determining transparency on a page (Annex A in ISO 19005-2 / 3), setting the transparency for a page due to the /S flag in the page group dictionary is redundant and should be removed. DEVSIX-2892
1 parent 3cdaed0 commit 2deec7b

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

pdfa/src/main/java/com/itextpdf/pdfa/checker/PdfA2Checker.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,6 @@ protected void checkPageObject(PdfDictionary pageDict, PdfDictionary pageResourc
614614
}
615615

616616
if (pageDict.containsKey(PdfName.Group) && PdfName.Transparency.equals(pageDict.getAsDictionary(PdfName.Group).getAsName(PdfName.S))) {
617-
transparencyObjects.add(pageDict);
618617
PdfObject cs = pageDict.getAsDictionary(PdfName.Group).get(PdfName.CS);
619618
if (cs != null) {
620619
PdfDictionary currentColorSpaces = pageResources.getAsDictionary(PdfName.ColorSpace);

pdfa/src/test/java/com/itextpdf/pdfa/PdfATransparencyCheckTest.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,33 @@ public void nestedXObjectWithTransparencyTest() {
221221
pdfDocument.close();
222222
}
223223

224+
@Test
225+
public void testTransparencyObjectsAbsence() throws IOException, InterruptedException {
226+
String outPdf = destinationFolder + "transparencyObjectsAbsence.pdf";
227+
String cmpPdf = cmpFolder + "cmp_transparencyObjectsAbsence.pdf";
228+
229+
PdfDocument pdfDocument = new PdfADocument(new PdfWriter(outPdf), PdfAConformanceLevel.PDF_A_3B, null);
230+
PdfPage page = pdfDocument.addNewPage();
231+
PdfFont font = PdfFontFactory.createFont(sourceFolder + "FreeSans.ttf", "Identity-H", true);
232+
233+
PdfCanvas canvas = new PdfCanvas(page);
234+
canvas.beginText()
235+
.moveText(36, 750)
236+
.setFontAndSize(font, 16)
237+
.showText("Page 1")
238+
.endText();
239+
240+
PdfDictionary groupObj = new PdfDictionary();
241+
groupObj.put(PdfName.Type, PdfName.Group);
242+
groupObj.put(PdfName.S, PdfName.Transparency);
243+
page.getPdfObject().put(PdfName.Group, groupObj);
244+
245+
page.getResources().setDefaultGray(new PdfCieBasedCs.CalGray(getCalGrayArray()));
246+
247+
pdfDocument.close();
248+
compareResult(outPdf, cmpPdf);
249+
}
250+
224251
private void compareResult(String outPdf, String cmpPdf) throws IOException, InterruptedException {
225252
String result = new CompareTool().compareByContent(outPdf, cmpPdf, destinationFolder, "diff_");
226253
if (result != null) {

0 commit comments

Comments
 (0)