aspose file tools*
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
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: 8
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: 42292
    
  64
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to read pdf file through java API