thomas6188
Broken In
Hi,
This is a basic tutorial in java, that shows how to read a pdf file. For this we use a library called iText . Using iText library, we can perform various pdf operations that it supports.
In this section , we are dealing with calculating the no. of pages & extracting the contents of each individual page.The steps are given below :
Add the iText library, by adding iText.jar to the lib folder of the project.
Use the following code to extract the content
Note: This program extracts only the text part and not the images.
Hope this program helps you start with basic pdf editing. Do revert back for queries
This is a basic tutorial in java, that shows how to read a pdf file. For this we use a library called iText . Using iText library, we can perform various pdf operations that it supports.
In this section , we are dealing with calculating the no. of pages & extracting the contents of each individual page.The steps are given below :
Add the iText library, by adding iText.jar to the lib folder of the project.
Use the following code to extract the content
Code:
PdfReader reader = new PdfReader(INPUTFILE);
int n = reader.getNumberOfPages();
String str=PdfTextExtractor.getTextFromPage(reader, 2); //Extracting the content from a particular page.
System.out.println(str);
Hope this program helps you start with basic pdf editing. Do revert back for queries
Last edited: