Forum     

Go Back   Digit Technology Discussion Forum > Community > Tutorials
Register FAQ Calendar Mark Forums Read

Tutorials This section offers tutorials and How to's on just about anything related to computers and IT. Note: All tutorials are courtesy the posters and not verified by Digit


Reply
 
LinkBack (6) Thread Tools Display Modes
Old 06-01-2011, 10:18 AM   6 links from elsewhere to this Post. Click to view. #1 (permalink)
Right Off the Assembly Line
 
Join Date: Dec 2010
Posts: 12
Default Java Tutorial 1: Read a pdf file in Java using iText library


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

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);
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

Last edited by thomas6188; 07-01-2011 at 07:29 PM.
thomas6188 is offline   Reply With Quote
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


LinkBacks (?)
LinkBack to this Thread: http://www.thinkdigit.com/forum/tutorials/135755-java-tutorial-1-read-pdf-file-java-using-itext-library.html
Posted By For Type Date
LearnYourTopic: Read a pdf file in Java using iText library This thread Refback 30-04-2012 05:00 AM
LearnYourTopic: Read a pdf file in Java using iText library This thread Refback 17-04-2012 02:03 PM
LearnYourTopic: Read a pdf file in Java using iText library This thread Refback 01-02-2012 06:18 PM
LearnYourTopic: Read a pdf file in Java using iText library This thread Refback 16-11-2011 11:03 PM
LearnYourTopic This thread Refback 16-11-2011 09:28 AM
[java]Czytanie PDF - polish:Elite:board This thread Refback 05-05-2011 11:08 AM

 
Latest Threads
- by Who
- by Krow
- by clmlbx
- by Tech&ME
- by icebags

Advertisement




All times are GMT +5.5. The time now is 08:51 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2