You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Jukka Zitting (JIRA)" <ji...@apache.org> on 2008/08/04 19:50:44 UTC

[jira] Created: (PDFBOX-348) java.lang.NoClassDefFoundError: org/fontbox/afm/AFMParser

java.lang.NoClassDefFoundError: org/fontbox/afm/AFMParser
---------------------------------------------------------

                 Key: PDFBOX-348
                 URL: https://issues.apache.org/jira/browse/PDFBOX-348
             Project: PDFBox
          Issue Type: Bug
          Components: Text extraction
            Reporter: Jukka Zitting


[Issue from SourceForge]
http://sourceforge.net/tracker/index.php?func=detail&aid=1915332&group_id=78314&atid=552832

Hi all.

Been trying to get the PDFTextStripper to work with simple PDF files but I
usually get two results with my code:

1.) I get nothing at all.
2.) I get an error. Part of which says "java.lang.NoClassDefFoundError:
org/fontbox/afm/AFMParser".

Here is a sample of my code:
public String getPDF(String strDirectory, String strFilename) {
String strContents = "";
File PDFDoc = new File(strDirectory + "\\" + strFilename);

try {
FileInputStream fis = new FileInputStream(PDFDoc);
strContents = strFilename + " was found.<br><br>";
try {
PDDocument pdDoc = null;
PDFParser parseDoc = new PDFParser(fis);
parseDoc.parse();
pdDoc = parseDoc.getPDDocument();
pdDoc.getNumberOfPages();
try {
PDFTextStripper stripper = new PDFTextStripper();
strContents = stripper.getText(pdDoc);
} catch(IOException e) {
return "Error encountered while stripping text: " +
e.getMessage();
}
return "strContents: " + strContents;
} catch(IOException e) {
return "Error encountered while trying to parse PDF document: "
+ e.getMessage();
}
} catch(FileNotFoundException e) {
return "Error encountered while trying to do a FileInputStream: "
+ e.getMessage();
}
}

Can anybody here please tell me what I am doing wrong?

Thanks!

[Comment on SourceForge]
Date: 2008-04-06 15:56
Sender: david_keller
Logged In: YES 
user_id=2056038
Originator: NO

I had the same pb, and I put in my lib directory this 2 jar
FontBox-0.1.0.jar and checkstyle-all-4.2.jar.
And know it's work

[Comment on SourceForge]
Date: 2008-04-10 10:31
Sender: ocm-zeeman
Logged In: YES 
user_id=684413
Originator: NO

Downloading fontbox from http://www.fontbox.org ?!


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PDFBOX-348) java.lang.NoClassDefFoundError: org/fontbox/afm/AFMParser

Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PDFBOX-348?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651834#action_12651834 ] 

Andreas Lehmkühler commented on PDFBOX-348:
-------------------------------------------

I suggest to close this issue. The problem seemed to be some missing jars.


> java.lang.NoClassDefFoundError: org/fontbox/afm/AFMParser
> ---------------------------------------------------------
>
>                 Key: PDFBOX-348
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-348
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Text extraction
>            Reporter: Jukka Zitting
>
> [Issue from SourceForge]
> http://sourceforge.net/tracker/index.php?func=detail&aid=1915332&group_id=78314&atid=552832
> Hi all.
> Been trying to get the PDFTextStripper to work with simple PDF files but I
> usually get two results with my code:
> 1.) I get nothing at all.
> 2.) I get an error. Part of which says "java.lang.NoClassDefFoundError:
> org/fontbox/afm/AFMParser".
> Here is a sample of my code:
> public String getPDF(String strDirectory, String strFilename) {
> String strContents = "";
> File PDFDoc = new File(strDirectory + "\\" + strFilename);
> try {
> FileInputStream fis = new FileInputStream(PDFDoc);
> strContents = strFilename + " was found.<br><br>";
> try {
> PDDocument pdDoc = null;
> PDFParser parseDoc = new PDFParser(fis);
> parseDoc.parse();
> pdDoc = parseDoc.getPDDocument();
> pdDoc.getNumberOfPages();
> try {
> PDFTextStripper stripper = new PDFTextStripper();
> strContents = stripper.getText(pdDoc);
> } catch(IOException e) {
> return "Error encountered while stripping text: " +
> e.getMessage();
> }
> return "strContents: " + strContents;
> } catch(IOException e) {
> return "Error encountered while trying to parse PDF document: "
> + e.getMessage();
> }
> } catch(FileNotFoundException e) {
> return "Error encountered while trying to do a FileInputStream: "
> + e.getMessage();
> }
> }
> Can anybody here please tell me what I am doing wrong?
> Thanks!
> [Comment on SourceForge]
> Date: 2008-04-06 15:56
> Sender: david_keller
> Logged In: YES 
> user_id=2056038
> Originator: NO
> I had the same pb, and I put in my lib directory this 2 jar
> FontBox-0.1.0.jar and checkstyle-all-4.2.jar.
> And know it's work
> [Comment on SourceForge]
> Date: 2008-04-10 10:31
> Sender: ocm-zeeman
> Logged In: YES 
> user_id=684413
> Originator: NO
> Downloading fontbox from http://www.fontbox.org ?!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (PDFBOX-348) java.lang.NoClassDefFoundError: org/fontbox/afm/AFMParser

Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-348?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Lehmkühler resolved PDFBOX-348.
---------------------------------------

       Resolution: Invalid
    Fix Version/s: 0.8.0-incubator

I guess the solution is to add the missing jar(s) and not a problem with pdfbox.

> java.lang.NoClassDefFoundError: org/fontbox/afm/AFMParser
> ---------------------------------------------------------
>
>                 Key: PDFBOX-348
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-348
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Text extraction
>            Reporter: Jukka Zitting
>             Fix For: 0.8.0-incubator
>
>
> [Issue from SourceForge]
> http://sourceforge.net/tracker/index.php?func=detail&aid=1915332&group_id=78314&atid=552832
> Hi all.
> Been trying to get the PDFTextStripper to work with simple PDF files but I
> usually get two results with my code:
> 1.) I get nothing at all.
> 2.) I get an error. Part of which says "java.lang.NoClassDefFoundError:
> org/fontbox/afm/AFMParser".
> Here is a sample of my code:
> public String getPDF(String strDirectory, String strFilename) {
> String strContents = "";
> File PDFDoc = new File(strDirectory + "\\" + strFilename);
> try {
> FileInputStream fis = new FileInputStream(PDFDoc);
> strContents = strFilename + " was found.<br><br>";
> try {
> PDDocument pdDoc = null;
> PDFParser parseDoc = new PDFParser(fis);
> parseDoc.parse();
> pdDoc = parseDoc.getPDDocument();
> pdDoc.getNumberOfPages();
> try {
> PDFTextStripper stripper = new PDFTextStripper();
> strContents = stripper.getText(pdDoc);
> } catch(IOException e) {
> return "Error encountered while stripping text: " +
> e.getMessage();
> }
> return "strContents: " + strContents;
> } catch(IOException e) {
> return "Error encountered while trying to parse PDF document: "
> + e.getMessage();
> }
> } catch(FileNotFoundException e) {
> return "Error encountered while trying to do a FileInputStream: "
> + e.getMessage();
> }
> }
> Can anybody here please tell me what I am doing wrong?
> Thanks!
> [Comment on SourceForge]
> Date: 2008-04-06 15:56
> Sender: david_keller
> Logged In: YES 
> user_id=2056038
> Originator: NO
> I had the same pb, and I put in my lib directory this 2 jar
> FontBox-0.1.0.jar and checkstyle-all-4.2.jar.
> And know it's work
> [Comment on SourceForge]
> Date: 2008-04-10 10:31
> Sender: ocm-zeeman
> Logged In: YES 
> user_id=684413
> Originator: NO
> Downloading fontbox from http://www.fontbox.org ?!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.