Hi, the feature request came in Aug 20, unfortunately it is not possible for us to release this feature by Aug 31. If you need it so urgently, it is possible you could implement this on your side using PDFTron core API. Otherwise we will try to schedule it in next month release (not the upcoming one, but the one after that). Could you let us know what you think?
Hi,
We need this ASAP, could you please include this as part of next realease.
Meanwhile please share any sample code which demonstrate the use of core API’s to achieve these.
You can call the following code snippet to traverse the layers in the document:
public static void handleLayers(@NonNull PDFDoc pdfDoc) throws PDFNetException {
Config config = pdfDoc.getOCGConfig();
Obj order = config.getOrder();
if (order != null) {
for (int i = 0; i < order.size(); i++) {
handleGroup(order.getAt(i));
}
}
}
private static void handleGroup(Obj group) throws PDFNetException {
if (group.isArray()) { // it is an array of dicts or an array of arrays...
Obj wl = group.getAt(0);
Group ocg = new Group(wl);
if (ocg.isValid()) { // if the array itself is an array of OCGs
long sz = group.size();
for (int x = 0; x < sz; x++) {
handleGroup(group.getAt(x)); // handle the sublayers
}
} else { // handle array
Log.d("handleGroup", "Group name = " + wl.getAsPDFText());// 0 is the Name of the group
long sz = group.size();
for (int x = 1; x < sz; x++) {
handleGroup(group.getAt(x)); // handle the sublayers
}
}
} else if (group.isDict()) { // it is a normal ocg, handle it
Group ocg = new Group(group);
Log.d("handleGroup", "Group name = " + ocg.getName());// 0 is the Name of the group
}
}
Additionally there are a number of helper methods in the PdfLayerUtils class that will help with layer states.
Currently the team is working on adding nested layers to the PDFTron Android SDK and as mentioned previously we will try to schedule it for the next month’s release. We can also update you with a snapshot version to try out when this feature is ready.
We are expecting this to be released in roughly two weeks, but we could provide a snapshot build prior to that if you desire. Please let us know if this is required.
I still see the issue. Please verify with attached pdf, try to open this pdf in Acrobat and try with pdftron. you will see the difference pdf_layer_new.pdf (117.5 KB)
Thanks for the update and it did work as expected, thanks a lot for the solution. May I know is this feature is available in release versions, if so please provide the SDK version as we are currently using 9.0.1