[英]DynamicPDF api to render PDF forms in Java
[英]Use PDF Forms as Java UI
我已经看到使用iText可以创建交互式PDF表单( http://itextpdf.com/book/chapter.php?id=8 )。 这非常有趣,我想知道是否可以从Java Desktop应用程序内部填写PDF表单。 最后,我需要知道是否可以从Java应用程序中打开PDF文件。 这有没有可能 ?
谢谢
您可以考虑使用ICEPDF (可在OpenSource版本和Pro版本中使用)。 从文档中获取的以下示例显示了如何在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);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.