3

请朋友们我在查看pdf文件时遇到这个困难,它给出了下面的错误

org.icepdf.core.pobjects.Document 警告:在类路径上找不到 PDF 写入支持 2017 年 6 月 9 日上午 8:32:10 org.icepdf.core.pobjects.Catalog

下面是我的代码

import javax.swing.JFrame;
import javax.swing.JPanel;
import org.icepdf.ri.common.ComponentKeyBinding;
import org.icepdf.ri.common.SwingController;
import org.icepdf.ri.common.SwingViewBuilder;

/**
 *
 * @author LabaPc
 */
public class viewPDF {



    public viewPDF() {

    }

    public void displayPDF(JPanel viewerComponentPanel, String filePath) {
        // build a controller
        SwingController controller = new SwingController();

// Build a SwingViewFactory configured with the controller
        SwingViewBuilder factory = new SwingViewBuilder(controller);

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

// add copy keyboard command
        ComponentKeyBinding.install(controller, viewerComponentPanel);

// add interactive mouse link annotation support via callback
        controller.getDocumentViewController().setAnnotationCallback(
                new org.icepdf.ri.common.MyAnnotationCallback(
                        controller.getDocumentViewController()));

        controller.openDocument(filePath);
    }
}

Below is the method that calls the code above
public void viewFile(){
String canonicalPath = tempFileHolder.get(scriptName);
            viewPDF vw = new viewPDF();
            vw.displayPDF(jPanelGrader,canonicalPath);
}
4

1 回答 1

2

这不是错误,只是警告。通常是因为icepdf的开源版本缺少写支持,只有core和viewer。

于 2018-05-26T13:09:26.877 回答