简体   繁体   English

如何阅读PDF文件并将其显示在JTextPane上?

[英]How to read PDF file and display it on JTextPane?

I want to do a program that can choose a PDF file from my computer and later crop in few portions by automatically. 我想做一个程序,可以从我的计算机中选择一个PDF file ,然后自动将其分成几部分。

The concept I had first created a JfileChooser to select the file I want and display it on JTextPane , and then read / determine the structure of PDF file in order to crop in according to the portion I want. 我首先创建了一个JfileChooser来选择我想要的文件并在JTextPane上显示它的概念,然后读取/确定PDF文件的结构以便根据我想要的部分进行裁剪。

Can I ask how to do it? 请问该怎么做? Any library I can refer to? 我可以参考任何图书馆吗?

You could use this PDFBox API to manipulate PDF file to your Java program. 您可以使用此PDFBox API将PDF文件处理到Java程序中。 There is enough documentation there about text extraction for you to follow. 那里有足够的有关文本提取的文档供您参考。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM