Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem using PDFBox to extract text from PDF documents  RSS feed

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am trying to extract the textual content of PDF files from my Java code. I (am trying to) use PDFBox 0.7.3 and the examples I have found online so far are rather limited. Basically, I did something like this:


and I get the following exception:


Any suggestions from the more PDFbox-experienced users?
 
Rancher
Posts: 42975
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

org/fontbox/afm/AFMParser


Do you have that class on your classpath? Maybe PDFBox comes in several jar files.
 
Konstantinos Vasileiou
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:

org/fontbox/afm/AFMParser


Do you have that class on your classpath? Maybe PDFBox comes in several jar files.




Yes, you are right. I needed to add the FontBox jar to my build path in order to make it work... Thanks!
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
add dependency jar : fontbox-1.3.1 
(mentioned version as per my request)
 
Saloon Keeper
Posts: 4552
112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This topic is now 9 years old, and Konstantinos hasn't posted since 2009, so this is unlikely to help. Nonethelesss I want to point out that nobody should use either version 0.7.3 or 1.3.1 of PDFBox at this point - both have been obsolete for years.
 
Marshal
Posts: 59389
187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But welcome to the Ranch
 
Yeah. What he said. Totally. Wait. What? Sorry, I was looking at this tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!