PDFBox for processing pdf in android - Stack Overflow [PDF]

Mar 14, 2012 - It seems that PDFBox is depending on awt and swing classes that are not available on Android devices. The

4 downloads 24 Views 95KB Size

Recommend Stories


A Case Study of Stack Overflow
You have survived, EVERY SINGLE bad day so far. Anonymous

pdf Android 6 for Programmers
And you? When will you begin that long journey into yourself? Rumi

PDF Kotlin for Android Developers
Those who bring sunshine to the lives of others cannot keep it from themselves. J. M. Barrie

Recognizing Gender of Stack Overflow Users
It always seems impossible until it is done. Nelson Mandela

Evaluation and Prediction of Content Quality in Stack Overflow
If you are irritated by every rub, how will your mirror be polished? Rumi

Java Programming For Android For Dummies Pdf
Don't ruin a good today by thinking about a bad yesterday. Let it go. Anonymous

declarative stack for distributed graph processing
In the end only three things matter: how much you loved, how gently you lived, and how gracefully you

Android Security Internals Pdf
Do not seek to follow in the footsteps of the wise. Seek what they sought. Matsuo Basho

Foxit PDF SDK (Android)
Your big opportunity may be right where you are now. Napoleon Hill

Android Security Internals Pdf
Suffering is a gift. In it is hidden mercy. Rumi

Idea Transcript


PDFBox for processing pdf in android Ask Question

i am trying to use pdfbox lib into my android app but im getting java.lang.NoClassDefFoundError: org.pdfbox.pdmodel.PDDocument

this error .as i'm developing commercial app i can not use other Lib like itext .So my question is can we use PDfBox in android. here is my code:PDFParser parser = null; String parsedText = null; PDFTextStripper pdfStripper; PDDocument pdDoc = null; COSDocument cosDoc = null; PDDocumentInformation pdDocInfo; try { f =new File(Environment.getExternalStorageDirectory()+File.separator+"Download"+File.separator

if(f.exists()){ System.out.println("---------exists-----------"); }else{ System.out.println("------NOT----exists----------"); } parser = new PDFParser(new FileInputStream(f)); } catch (Exception e) { System.out.println("Unable to open PDF Parser."); System.out.println("-----------------------error|"+e.toString()); } try { parser.parse(); cosDoc = parser.getDocument(); pdfStripper = new PDFTextStripper(); pdDoc = new PDDocument(cosDoc);//here i'm getting exception //pdDoc = PDDocument.load(f, false); parsedText = pdfStripper.getText(pdDoc); } catch (Exception e) { System.out.println("-----------------------error|"+e.toString()); System.out.println("An exception occured in parsing the PDF Document."); e.printStackTrace(); try { if (cosDoc != null) cosDoc.close(); if (pdDoc != null) pdDoc.close(); } catch (Exception e1) { e.printStackTrace(); } } System.out.println("Done."); System.out.println("-----------------------parsedText|"+parsedText);

using PDFBox 0.7.3 jar android pdfbox edited Mar 14 '12 at 8:19

asked Mar 14 '12 at 4:55

Prachi 1,849

can we see you code.... – Its not blank Mar 14 '12 at 7:43

@Vincent i have posted code just check it – Prachi Mar 14 '12 at 8:20

3 Answers

It seems that PDFBox is depending on awt and swing classes that are not available on Android devices. Therefor you can not use PDFBox on Android. answered Jun 22 '12 at 13:19

Janusz 99.3k

97

268

353

NoClassDefFoundError is thrown when the JVM can't load a class. As the javadoc says Have you included the pdfbox library on classpath during compilation? answered Apr 10 '12 at 21:43

Shyba 18

6

@Shyda yes i have included pdfbox lib but still no luck... – Prachi Apr 11 '12 at 10:47

@curious_mind See this question . Is it the same error? – Shyba Apr 11 '12 at 16:56

If you only need to extract text from PDF document in Android , then use this https://github.com/RatheeshRavindran/PDFBoxLight I recently did the porting of PDFBox to Android but please note that this still in Beta. answered Jun 6 '14 at 4:06

ratheesh 11

ok i will try this :) – Prachi Jun 6 '14 at 7:08



Join Stack Overflow to learn, share knowledge, and build your career. Email Sign Up OR SIGN IN WITH

Google Facebook

2

4

20

36

Smile Life

When life gives you a hundred reasons to cry, show life that you have a thousand reasons to smile

Get in touch

© Copyright 2015 - 2024 PDFFOX.COM - All rights reserved.