Pdf layers


Is there a way to check if the existing pdf has layers? How to get information of that layers?
Note: I know there is a way to add layers but I don’t see any way to get layers from existing document. The code snippet below to get layers from existing pdf return null.

Document pdfDocument = new Document("sample.pdf");
pdfDocument.getPages().get_Item(1).getLayers(); // this is return NULL

Please find the test code, sample pdf - Generated by Aspose PDF - and test log in attachment
testCode_sampleData.zip (34.4 KB)

Layers shown in Foxit reader
image.png (32.2 KB)

Please also note that I have used latest version of 20.12



We have noticed the similar issue in our environment during testing and have logged it as PDFJAVA-40041 in our issue tracking system. We will definitely look into details of this issue and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.


Thanks for your feedback. I hope this would be fixed soon.


The issue will surely be resolved/fixed. However, it will be resolved on a first come first serve basis and we will inform you once we make some definite progress towards its resolution. Please give us some time.

The issues you have found earlier (filed as PDFJAVA-40041) have been fixed in Aspose.PDF for Java 22.1.