{"id":361,"date":"2012-06-06T21:23:57","date_gmt":"2012-06-06T19:23:57","guid":{"rendered":"http:\/\/www.pellissier.co.za\/hermien\/?p=361"},"modified":"2019-05-21T11:34:20","modified_gmt":"2019-05-21T09:34:20","slug":"customising-the-icepdf-viewer-programmatically","status":"publish","type":"post","link":"https:\/\/www.pellissier.co.za\/hermien\/?p=361","title":{"rendered":"Customising the ICEpdf Viewer Programmatically"},"content":{"rendered":"<p>I recently started using the excellent <a href=\"http:\/\/www.icesoft.org\/projects\/ICEpdf\/overview.jsf\">ICEpdf<\/a> library to display PDFs in a Java application. And as invariably happens with most libraries, I wanted to do something that is just not documented anywhere yet. \ud83d\ude42 Or at least anywhere that I can find&#8230;<\/p>\n<p>But lets first look at the available documentation:<\/p>\n<ul>\n<li><a href=\"http:\/\/wiki.icesoft.org\/display\/PDF\/Using+the+PDF+Viewer+Component\">Using the PDF Viewer Component<\/a><\/li>\n<li><a href=\"http:\/\/wiki.icesoft.org\/display\/PDF\/Customizing+the+Viewer\">Customizing the Viewer<\/a><\/li>\n<li><a href=\"http:\/\/wiki.icesoft.org\/display\/PDF\/Customizing+the+SwingViewBuilder\">Customizing the SwingViewBuilder<\/a><\/li>\n<\/ul>\n<p>I am using the Viewer, creating the panel as per the first link above. But I want to configure which buttons are visible on the toolbar at run time, according to user settings persisted in a database. This rules out the option of using the config file route. And hence I needed to find a way to change the configuration programmatically.<\/p>\n<p>So I debugged into the source code, and I found out that there is indeed an easy way. \ud83d\ude42<\/p>\n<p>[java]SwingController controller = new SwingController();<br \/>\nPropertiesManager propertiesManager = new PropertiesManager(<br \/>\nSystem.getProperties(), new Properties(),<br \/>\ncontroller.getMessageBundle());<br \/>\npropertiesManager.setBoolean(<br \/>\nPropertiesManager.PROPERTY_SHOW_UTILITY_SAVE, false);<br \/>\nSwingViewBuilder factory =<br \/>\nnew SwingViewBuilder(controller, propertiesManager);<br \/>\nJPanel viewerComponentPanel = factory.buildViewerPanel();[\/java]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently started using the excellent ICEpdf library to display PDFs in a Java application. And as invariably happens with most libraries, I wanted to do something that is just not documented anywhere yet. \ud83d\ude42 Or at least anywhere that I can find&#8230; But lets first look at the available documentation: Using the PDF Viewer &#8230; <a title=\"Customising the ICEpdf Viewer Programmatically\" class=\"read-more\" href=\"https:\/\/www.pellissier.co.za\/hermien\/?p=361\" aria-label=\"More on Customising the ICEpdf Viewer Programmatically\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[9],"tags":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1v8WL-5P","_links":{"self":[{"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/posts\/361"}],"collection":[{"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=361"}],"version-history":[{"count":1,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/posts\/361\/revisions"}],"predecessor-version":[{"id":1124,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/posts\/361\/revisions\/1124"}],"wp:attachment":[{"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}