[英]How to read PDF file through iText and display it as in Adobe Reader?
I use com.itextpdf.text.pdf.PdfReader
and com.itextpdf.text.pdf.parser.PdfTextExtractor
package, and tried: 我使用
com.itextpdf.text.pdf.PdfReader
和com.itextpdf.text.pdf.parser.PdfTextExtractor
包,并尝试过:
String pagedata=PdfTextExtractor.getTextFromPage(reader,pageno)
and put the pagedata into a JTextArea. 并将页面数据放入JTextArea。
But by doing this it skips all the images and font sizes and colors and shows only same-sized text data. 但是这样做可以跳过所有图像,字体大小和颜色,并且仅显示相同大小的文本数据。
I want to fetch all full fledged page by page data as in Adobe Reader. 我想像Adobe Reader一样逐页获取所有完整的数据。 How can I do this and in which component should I place the fetched page?
我该怎么办?应该将获取的页面放在哪个组件中? Obviously not on JTextArea...
显然不在JTextArea上...
You can use Desktop class to call Adobe Reader. 您可以使用Desktop类来调用Adobe Reader。
Desktop.getDesktop().open(file.pdf);
// where file.pdf is your file instance.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.