警告:在类路径上找不到PDF写入支持

时间:2017-06-09 10:34:14

标签: java pdf view icepdf

请朋友们在查看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);
}

1 个答案:

答案 0 :(得分:1)

这不是一个错误,只是一个警告。通常因为icepdf的开源版本缺少写入支持,只有核心和查看器。