File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to read pdf file through java API

 
Jabi Vulla
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 679
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic