We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

If the bookmark has multiple actions, use A to get all the actions of the bookmark

If the bookmark has multiple actions, use A to get all the actions of the bookmark.
p1.png (10.1 KB)

@wusk

Could you please share a sample PDF in which bookmark has more than one Action? Also, please share the information details which you want to extract from that PDF. We will check related details at our end and share our feedback with you.

Thank you for your help.For example the attached test.pdf,the bookmark has two actions. We can only get one Action using Aspose.pdf for java. How do I get all actions in a bookmark.
test.pdf (63.3 KB)
p1.png (45.1 KB)

@wusk

We need to investigate this particular requirement of yours and we have logged an investigation ticket as PDFJAVA-40123 in our issue tracking system for the purpose. We will look into its details and keep you posted with the status of ticket resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.

Thank you very much for your help and look forward to your results.

@wusk

We will surely check the logged ticket on a first come first serve basis and let you know once additional updates are available.

@wusk

We have investigated the earlier logged ticket. Use the following code to achieve your requirements:

       Document document=new Document(dataDir + "test.pdf");
        for(OutlineItemCollection itemCollection:document.getOutlines())
        {
            IAppointment destination = itemCollection.getDestination();
            if (destination !=null) {
                if (destination instanceof XYZExplicitDestination) {
                    double zoom = ((XYZExplicitDestination) destination).getZoom();
                    Page page = ((XYZExplicitDestination)destination).getPage();
                    System.out.println(page.getNumber());
                    System.out.println("zoom: " + zoom);
                }
            }

            PdfAction action =  itemCollection.getAction();
            if (action!=null){
                if (action instanceof GoToURIAction) {
                    System.out.println("URI: " + ((GoToURIAction) action).getURI());
                    if (destination instanceof XYZExplicitDestination) {
                        Page page = ((XYZExplicitDestination) destination).getPage();
                        System.out.println("Destination page: " + page.getNumber());
                    }else if (destination instanceof FitHExplicitDestination) {
                        Page page = ((FitHExplicitDestination) destination).getPage();
                        System.out.println("Destination page: " + page.getNumber());
                    }
                }

                ActionCollection actionCollection = action.getNext();
                if (actionCollection !=null) {
                    System.out.println("Extra actions size: " + actionCollection.size());
                    if (actionCollection.size() == 1) {
                        PdfAction internalAction = actionCollection.get_Item(1);
                        if (internalAction instanceof GoToAction) {
                            IAppointment destination2 = ((GoToAction) internalAction).getDestination();
                            if (destination2 != null) {
                                if (destination2 instanceof XYZExplicitDestination) {
                                    double zoom = ((XYZExplicitDestination) destination2).getZoom();
                                    System.out.println("zoom: " + zoom);
                                    Page page = ((XYZExplicitDestination)destination).getPage();
                                    System.out.println("Destination page: " + page.getNumber());
                                }
                                if (destination2 instanceof FitHExplicitDestination) {
                                    System.out.println("Destination page: " + ((FitHExplicitDestination) destination2).getPage().getNumber());
                                    System.out.println(
                                            "Represents explicit destination that displays the page with the vertical coordinate top " +
                                                    "positioned at the top edge of the window and the contents of the page magnified just enough to " +
                                                    "fit the entire width of the page within the window.");
                                }
                                //can be other destination types
                            }
                        }
                    }
                }
            }
        }