1
我已經看到使用iText可以創建交互式PDF表單(http://itextpdf.com/book/chapter.php?id=8)。這很有趣,我想知道是否有可能從Java桌面應用程序中填充PDF表單。最後,我需要知道是否可以從Java應用程序中打開PDF文件。可能嗎 ?
謝謝使用PDF表格作爲Java UI
我已經看到使用iText可以創建交互式PDF表單(http://itextpdf.com/book/chapter.php?id=8)。這很有趣,我想知道是否有可能從Java桌面應用程序中填充PDF表單。最後,我需要知道是否可以從Java應用程序中打開PDF文件。可能嗎 ?
謝謝使用PDF表格作爲Java UI
您可以考慮使用ICEPDF,它可以在OpenSource版和專業版中使用。下面的示例顯示瞭如何在JPanel中顯示PDF:
String filePath = "somefilepath/myfile.pdf";
// 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.
JPanel 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()));
// Create a JFrame to display the panel in
JFrame window = new JFrame("Using the Viewer Component");
window.getContentPane().add(viewerComponentPanel);
window.pack();
window.setVisible(true);
// Open a PDF document to view
controller.openDocument(filePath);
謝謝,我現在查過了,太棒了!正是我需要的! – user2824073 2014-11-06 19:01:43
我不確定你在問什麼,請考慮修改。 – sage88 2014-11-06 18:19:13