This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes how to read pdf file through java API Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to read pdf file through java API" Watch "how to read pdf file through java API" New topic
Author

how to read pdf file through java API

Jabi Vulla
Greenhorn

Joined: Jan 20, 2013
Posts: 7
Can any one tell me how to read pdf file through java API

I used all jars like pdfbox.jar... but bo use , can any one explain me with code???
BufferedReader br = new BufferedReader(new FileReader("//Summary_RPT_PDF//"+reportname+".pdf"));
if (br.readLine()== null ) {
......
else{
....
}
it showing exception like ...The network path was not found along with file not found exception.
Stuart A. Burkett
Ranch Hand

Joined: May 30, 2012
Posts: 679
Jabi Vulla wrote:"//Summary_RPT_PDF//"+reportname+".pdf"))

it showing exception like ...The network path was not found along with file not found exception.

That would suggest that the file either doesn't exist or is not accessible from the program. Does it exist - the two sets of // in the name look suspicious.
Tushar Arsekar
Greenhorn

Joined: Jun 15, 2010
Posts: 7
Jabi Vulla wrote:Can any one tell me how to read pdf file through java API

I used all jars like pdfbox.jar... but bo use , can any one explain me with code???
BufferedReader br = new BufferedReader(new FileReader("//Summary_RPT_PDF//"+reportname+".pdf"));
if (br.readLine()== null ) {
......
else{
....
}
it showing exception like ...The network path was not found along with file not found exception.


If your file is on the shared network then access it using "\\hostname" + "\\Summary_RPT_PDF\\" + reportname + ".pdf"

If it is on your local drive then access it using "c:\\Summary_RPT_PDF\\" + reportname + ".pdf"
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41034
    
  43
For starters, PDF files contain binary data, not character data. That means any attempts to deal with them using Readers and Writers won't work - you need to use InputStreams and OutputStreams. Using those it is no problem to read and writ PDF files. But since you mention PDFBox, I'm guessing you want to achieve more than just get at the bytes that make up the file. If you told us what the underlying problem is, maybe we can point you to a more specific direction.


Ping & DNS - my free Android networking tools app
 
Don't get me started about those stupid light bulbs.
 
subject: how to read pdf file through java API
 
Similar Threads
read text and stroe date to the array
save txt file with file chooser
how to read pdf from java
Open password protected pdf, without password enter through java
How to convert Unusual data from PDF into readable form