问题描述
我想在新的Jframe中打开一个pdf文件。
pdf文件存在。我只需打开它并在新的Jframe中显示它。
我用户itext来创建pdf文件。我需要相同的工具来打开它。
请告诉我如何。
提前感谢。
I would like to open a pdf file in a new Jframe.the pdf file exist. I just need to open it and show it in a new Jframe.I user itext to create the pdf file. do I need the same tool to open it.please show me how.thanks in advance.
推荐答案
在Swing的的JFrame 。您可以考虑购买商业工具,例如或使用嵌入式浏览器,例如并在嵌入式浏览器中使用嵌入式PDF查看器(即Adobe Reader)显示PDF,但这也很棘手。
It is not that easy and straightforward to open PDF inside Swing's JFrame
. You can consider purchasing commercial tools such as pdfviewer or use embedded browser like JDIC and display your PDF using embedded PDF Viewer (i.e. Adobe Reader) inside an embedded browser but that is tricky as well.
我宁愿认真考虑使用 java.awt.Desktop.open()
方法在操作系统默认PDF查看器中打开PDF这是跨平台的。但请注意,Java 1.6及更高版本中提供了 Desktop
类。
I would rather seriously consider opening your PDF in OS default PDF viewer using java.awt.Desktop.open()
method which is designed to be cross-platform. Note however, that Desktop
class is available in Java 1.6 and later.
这篇关于如何使用itext在Jframe中打开pdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!