1

Am using icepdf to show pdf on my swing application. I have external buttons for pdf navigation. I need to navigate so many pdfs, but inside the same panel without closing.

My code for Icepdf:

public static void pdfviewerICE(currentpdfurl) {
    filePath = currentpdfurl;

    // build a controller
    SwingController controller = new SwingController();

    // Build a SwingViewFactory configured with the controller
    SwingViewBuilder factory = new SwingViewBuilder(controller);
    PropertiesManager properties = new PropertiesManager(
        System.getProperties(),
        ResourceBundle.getBundle(PropertiesManager.DEFAULT_MESSAGE_BUNDLE));

    properties.set(PropertiesManager.PROPERTY_DEFAULT_ZOOM_LEVEL, "1.75");

    JSplitPane jSplitPane_PDF = factory.buildUtilityAndDocumentSplitPane(true);
    controller.openDocument(filePath);
    if ((internalFrame.getComponents()!= null) || (internalFrame.isClosed())) {
         internalFrame.add(jSplitPane_PDF);
    internalFrame.show();
   }
}

This is loading same pdf everytime.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045

1 Answers1

2

Prasath Bala,

you have to make "controller" as public. Then call your controller when you pdf page is changed

Code: controller.openDocument(currentpdfurl);

I too had the same issue, this will solve your query for sure.

Nesh
  • 134
  • 9