Skip to content

Commit 6595c3a

Browse files
author
Dmitry Radchuk
committed
Fix review issues
DEVSIX-8576
1 parent 532081a commit 6595c3a

File tree

3 files changed

+3
-16
lines changed

3 files changed

+3
-16
lines changed

kernel/src/main/java/com/itextpdf/kernel/pdf/OcgPropertiesCopier.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public static Set<PdfIndirectReference> getOCGsFromPage(PdfPage page) {
9191
final List<PdfAnnotation> annotations = page.getAnnotations();
9292
for (PdfAnnotation annotation : annotations) {
9393
//Pass null instead of catalog OCProperties value, to include ocg clashing with catalog
94-
getUsedNonFlushedOCGsFromAnnotation(null, ocgs, annotation, annotation);
94+
getUsedNonFlushedOCGsFromAnnotation(annotation, annotation, ocgs, null);
9595
}
9696
final PdfDictionary resources = page.getPdfObject().getAsDictionary(PdfName.Resources);
9797
OcgPropertiesCopier.getUsedNonFlushedOCGsFromResources(resources, resources, ocgs,
@@ -117,7 +117,7 @@ private static Set<PdfIndirectReference> getAllUsedNonFlushedOCGs(Map<PdfPage, P
117117
final PdfAnnotation toAnnot = toAnnotations.get(j);
118118
final PdfAnnotation fromAnnot = fromAnnotations.get(j);
119119
if (!toAnnot.getPdfObject().isFlushed()) {
120-
getUsedNonFlushedOCGsFromAnnotation(toOcProperties, fromUsedOcgs, toAnnot, fromAnnot);
120+
getUsedNonFlushedOCGsFromAnnotation(toAnnot, fromAnnot, fromUsedOcgs, toOcProperties);
121121
}
122122
}
123123
}
@@ -130,7 +130,7 @@ private static Set<PdfIndirectReference> getAllUsedNonFlushedOCGs(Map<PdfPage, P
130130
return fromUsedOcgs;
131131
}
132132

133-
private static void getUsedNonFlushedOCGsFromAnnotation(PdfDictionary toOcProperties, Set<PdfIndirectReference> fromUsedOcgs, PdfAnnotation toAnnot, PdfAnnotation fromAnnot) {
133+
private static void getUsedNonFlushedOCGsFromAnnotation(PdfAnnotation toAnnot, PdfAnnotation fromAnnot, Set<PdfIndirectReference> fromUsedOcgs, PdfDictionary toOcProperties) {
134134
OcgPropertiesCopier.getUsedNonFlushedOCGsFromOcDict(toAnnot.getPdfObject().getAsDictionary(PdfName.OC),
135135
fromAnnot.getPdfObject().getAsDictionary(PdfName.OC), fromUsedOcgs, toOcProperties);
136136
OcgPropertiesCopier.getUsedNonFlushedOCGsFromXObject(toAnnot.getNormalAppearanceObject(),

kernel/src/test/java/com/itextpdf/kernel/pdf/layer/PdfLayerTest.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -474,19 +474,6 @@ public void testReadAllLayersFromPage1() throws IOException, InterruptedExceptio
474474
Assertions.assertNull(new CompareTool().compareByContent(destinationFolder + "output_layered_2.pdf", sourceFolder + "cmp_output_layered_2.pdf", destinationFolder, "diff"));
475475
}
476476

477-
@Test
478-
public void testReadAllLayersFromPage2() throws IOException, InterruptedException {
479-
PdfDocument pdfDoc = new PdfDocument(new PdfReader(sourceFolder + "input_layers_in_resources_xobject.pdf"));
480-
481-
List<PdfLayer> layersFromCatalog = pdfDoc.getCatalog().getOCProperties(true).getLayers();
482-
Assertions.assertEquals(16, layersFromCatalog.size());
483-
PdfPage page = pdfDoc.getPage(2);
484-
Set<PdfLayer> layersFromPage = page.getPdfLayers();
485-
//There is 8 ocgs nested under the resources xobject on 2nd page
486-
Assertions.assertEquals(8, layersFromPage.size());
487-
pdfDoc.close();
488-
}
489-
490477
@Test
491478
public void testReadAllLayersFromDocumentWithComplexOCG() throws IOException, InterruptedException {
492479
PdfDocument pdfDoc = new PdfDocument(new PdfReader(sourceFolder + "input_complex_layers.pdf"),

0 commit comments

Comments
 (0)