简体   繁体   中英

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:

String pagedata=PdfTextExtractor.getTextFromPage(reader,pageno)

and put the pagedata into a 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. How can I do this and in which component should I place the fetched page? Obviously not on JTextArea...

You can use Desktop class to call Adobe Reader.

Desktop.getDesktop().open(file.pdf);
// where file.pdf is your file instance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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