![](/img/trans.png)
[英]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.