ICEPDF 隐藏 pagenav ,最后一页和第一页

ICEPDF hide pagenav , last page and first page

我曾使用 icepdf 在 javafx 中显示 pdf libraries.Everything 成功,但我不想看到 toolbar.API 文档中的 'First Page' 和 'Last Page' 按钮显示如何完全隐藏页面导航器。

        propertiesManager.setBoolean("application.toolbar.show.pagenav", false);

我只想删除 'First Page' 和 'Last Page' buttons.Anyone 请帮忙?

遗憾的是,没有用于隐藏各个导航按钮的配置选项。但是覆盖 SwingViewBuilder 方法 buildPageNavigationToolBar() 相当容易。

使用示例 http://anonsvn.icesoft.org/repo/icepdf/branches/icepdf-6.2.0/icepdf/examples/component/ViewerComponentExample.java 您可以更改调用:

SwingViewBuilder factory = new SwingViewBuilder(controller, properties); 

看起来像这样:

SwingViewBuilder factory = new SwingViewBuilder(controller, properties){
    @Override
    public JToolBar buildPageNavigationToolBar() {
        JToolBar toolbar = new JToolBar();
        commonToolBarSetup(toolbar, false);
        addToToolBar(toolbar, buildPreviousPageButton());
        addToToolBar(toolbar, buildCurrentPageNumberTextField());
        addToToolBar(toolbar, buildNumberOfPagesLabel());
        addToToolBar(toolbar, buildNextPageButton());
        return toolbar;
    }
};

感谢@pcorless 隐藏打印和保存按钮使用

SwingViewBuilder factory = new SwingViewBuilder(controller, properties){
public JToolBar buildUtilityToolBar(boolean embeddableComponent, PropertiesManager propertiesManager) {
                JToolBar toolbar = new JToolBar();
                commonToolBarSetup(toolbar, false);
                // if embeddable component, we don't want to create the open dialog, as we
                // have no window manager for this case.
                if (PropertiesManager.checkAndStoreBooleanProperty(propertiesManager, PropertiesManager.PROPERTY_SHOW_UTILITY_SEARCH))
                    addToToolBar(toolbar, buildSearchButton());
                if (PropertiesManager.checkAndStoreBooleanProperty(propertiesManager, PropertiesManager.PROPERTY_SHOW_UTILITY_UPANE))
                    addToToolBar(toolbar, buildShowHideUtilityPaneButton());

                // Don't bother with this toolbar if we don't have any visible buttons
                if (toolbar.getComponentCount() == 0) {
                    return null;
                }

                return toolbar;
            }
});