-1

Java を使用して PDF リーダーを作成しています。独自の機能を作成できるように、独自のアプリケーションの JFrame で PDF ファイルを開きたいと考えています。それを行う方法はありますか?「iText」、「pdfBox」、および「ICEpdf」を使用してPDFドキュメントを操作しています。

4

1 に答える 1

2
  public static void pdfViewerICE() {
        String filePath = "PDF_URL";
        // build a controller
        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");

        // Use the factory to build a JPanel that is pre-configured
        //with a complete, active Viewer UI.
       JPanel viewerComponentPanel = factory.buildViewerPanel();

        controller.openDocument(filePath);
      }

上記のコードは、Java プログラムを介して ICEPDF を使用して PDF を開きます。注: クラスパスhttp://www.icesoft.org/java/downloads/icepdf-downloads.jsfに ICEPDF jar (icepdf-viewer.jar,icepdf-core.jar ) を含めます。

于 2015-04-18T09:27:17.317 に答える