You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by Kotev - Rivka klien <ri...@kotev.co.il> on 2014/02/09 12:01:45 UTC

problem with extracting text

Hello!

I'm writing in java

I tried your code in JApplet:

 

 

@Override

    public void init() {

PDFReader viewer = new PDFReader();

viewer.setVisible(true);

}

 

I opened file ktv1390898988640.pdf with the open menu and got this errors

Exception in thread "AWT-EventQueue-1" java.lang.NoClassDefFoundError:
org/apache/fontbox/afm/AFMParser

                at
org.apache.pdfbox.pdmodel.font.PDFont.addAdobeFontMetric(PDFont.java:144)

                at
org.apache.pdfbox.pdmodel.font.PDFont.getAdobeFontMetrics(PDFont.java:113)

                at
org.apache.pdfbox.pdmodel.font.PDFont.<clinit>(PDFont.java:105)

                at
org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:1
00)

                at
org.apache.pdfbox.pdmodel.PDResources.getFonts(PDResources.java:204)

                at
org.apache.pdfbox.util.PDFStreamEngine.getFonts(PDFStreamEngine.java:604)

                at
org.apache.pdfbox.util.operator.SetTextFont.process(SetTextFont.java:54)

                at
org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:
554)

                at
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java
:268)

                at
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java
:235)

                at
org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:21
5)

                at
org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:127)

                at
org.apache.pdfbox.pdfviewer.PDFPagePanel.paint(PDFPagePanel.java:98)

                at javax.swing.JComponent.paintChildren(Unknown Source)

                at javax.swing.JComponent.paint(Unknown Source)

                at javax.swing.JComponent.paintChildren(Unknown Source)

                at javax.swing.JComponent.paint(Unknown Source)

                at javax.swing.JComponent.paintChildren(Unknown Source)

                at javax.swing.JComponent.paint(Unknown Source)

                at javax.swing.JViewport.paint(Unknown Source)

                at javax.swing.JComponent.paintChildren(Unknown Source)

                at javax.swing.JComponent.paint(Unknown Source)

                at javax.swing.JComponent.paintChildren(Unknown Source)

                at javax.swing.JComponent.paint(Unknown Source)

                at javax.swing.JComponent.paintChildren(Unknown Source)

                at javax.swing.JComponent.paint(Unknown Source)

                at javax.swing.JLayeredPane.paint(Unknown Source)

                at javax.swing.JComponent.paintChildren(Unknown Source)

                at javax.swing.JComponent.paintToOffscreen(Unknown Source)

                at
javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)

                at javax.swing.RepaintManager$PaintManager.paint(Unknown
Source)

                at javax.swing.RepaintManager.paint(Unknown Source)

                at javax.swing.JComponent.paint(Unknown Source)

                at java.awt.GraphicsCallback$PaintCallback.run(Unknown
Source)

                at sun.awt.SunGraphicsCallback.runOneComponent(Unknown
Source)

                at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)

                at java.awt.Container.paint(Unknown Source)

                at java.awt.Window.paint(Unknown Source)

                at javax.swing.RepaintManager$3.run(Unknown Source)

                at javax.swing.RepaintManager$3.run(Unknown Source)

                at java.security.AccessController.doPrivileged(Native
Method)

                at
java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

                at javax.swing.RepaintManager.paintDirtyRegions(Unknown
Source)

                at javax.swing.RepaintManager.paintDirtyRegions(Unknown
Source)

                at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown
Source)

                at javax.swing.RepaintManager.access$1100(Unknown Source)

                at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown
Source)

                at java.awt.event.InvocationEvent.dispatch(Unknown Source)

                at java.awt.EventQueue.dispatchEventImpl(Unknown Source)

                at java.awt.EventQueue.access$200(Unknown Source)

                at java.awt.EventQueue$3.run(Unknown Source)

                at java.awt.EventQueue$3.run(Unknown Source)

                at java.security.AccessController.doPrivileged(Native
Method)

                at
java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

                at java.awt.EventQueue.dispatchEvent(Unknown Source)

                at
java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

                at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown
Source)

                at
java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

                at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

                at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

                at java.awt.EventDispatchThread.run(Unknown Source)

Caused by: java.lang.ClassNotFoundException:
org.apache.fontbox.afm.AFMParser

                at java.net.URLClassLoader$1.run(Unknown Source)

                at java.net.URLClassLoader$1.run(Unknown Source)

                at java.security.AccessController.doPrivileged(Native
Method)

                at java.net.URLClassLoader.findClass(Unknown Source)

                at java.lang.ClassLoader.loadClass(Unknown Source)

                at sun.misc.Launcher$AppClassLoader.loadClass(Unknown
Source)

                at java.lang.ClassLoader.loadClass(Unknown Source)

                ... 61 more

 

 

I tried the other file and got

Exception in thread "AWT-EventQueue-1" java.lang.NoClassDefFoundError:
org.apache.pdfbox.pdmodel.font.PDSimpleFont

                at
org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:1
08)

                at
org.apache.pdfbox.pdmodel.PDResources.getFonts(PDResources.java:204)

                at
org.apache.pdfbox.util.PDFStreamEngine.getFonts(PDFStreamEngine.java:604)

                at
org.apache.pdfbox.util.operator.SetTextFont.process(SetTextFont.java:54)

                at
org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:
554)

                at
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java
:268)

                at
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java
:235)

                at
org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:21
5)

                at
org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:127)

                at
org.apache.pdfbox.pdfviewer.PDFPagePanel.paint(PDFPagePanel.java:98)

                at javax.swing.JComponent.paintChildren(Unknown Source)

                at javax.swing.JComponent.paint(Unknown Source)

                at javax.swing.JComponent.paintChildren(Unknown Source)

                at javax.swing.JComponent.paint(Unknown Source)

                at javax.swing.JComponent.paintChildren(Unknown Source)

                at javax.swing.JComponent.paint(Unknown Source)

                at javax.swing.JViewport.paint(Unknown Source)

                at javax.swing.JComponent.paintChildren(Unknown Source)

                at javax.swing.JComponent.paint(Unknown Source)

                at javax.swing.JComponent.paintChildren(Unknown Source)

                at javax.swing.JComponent.paint(Unknown Source)

                at javax.swing.JComponent.paintChildren(Unknown Source)

                at javax.swing.JComponent.paint(Unknown Source)

                at javax.swing.JLayeredPane.paint(Unknown Source)

                at javax.swing.JComponent.paintChildren(Unknown Source)

                at javax.swing.JComponent.paintToOffscreen(Unknown Source)

                at
javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)

                at javax.swing.RepaintManager$PaintManager.paint(Unknown
Source)

                at javax.swing.RepaintManager.paint(Unknown Source)

                at javax.swing.JComponent.paint(Unknown Source)

                at java.awt.GraphicsCallback$PaintCallback.run(Unknown
Source)

                at sun.awt.SunGraphicsCallback.runOneComponent(Unknown
Source)

                at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)

                at java.awt.Container.paint(Unknown Source)

                at java.awt.Window.paint(Unknown Source)

                at javax.swing.RepaintManager$3.run(Unknown Source)

                at javax.swing.RepaintManager$3.run(Unknown Source)

                at java.security.AccessController.doPrivileged(Native
Method)

                at
java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

                at javax.swing.RepaintManager.paintDirtyRegions(Unknown
Source)

                at javax.swing.RepaintManager.paintDirtyRegions(Unknown
Source)

                at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown
Source)

                at javax.swing.RepaintManager.access$1100(Unknown Source)

                at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown
Source)

                at java.awt.event.InvocationEvent.dispatch(Unknown Source)

                at java.awt.EventQueue.dispatchEventImpl(Unknown Source)

                at java.awt.EventQueue.access$200(Unknown Source)

                at java.awt.EventQueue$3.run(Unknown Source)

                at java.awt.EventQueue$3.run(Unknown Source)

                at java.security.AccessController.doPrivileged(Native
Method)

                at
java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

                at java.awt.EventQueue.dispatchEvent(Unknown Source)

                at
java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

                at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown
Source)

                at
java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

                at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

                at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

                at java.awt.EventDispatchThread.run(Unknown Source)

 

what can I do?


Re: problem with extracting text

Posted by Tilman Hausherr <TH...@t-online.de>.
Did you include fontbox?
https://pdfbox.apache.org/dependencies.html

"The main PDFBox component, pdfbox, has hard dependencies on the fontbox 
and jempbox components and the commons-logging 
<http://commons.apache.org/logging/> library. "

Tilman

Am 09.02.2014 12:01, schrieb Kotev - Rivka klien:
>
> Hello!
>
> I'm writing in java
>
> I tried your code in JApplet:
>
> @Override
>
> *public**void*init() {
>
> PDFReader viewer = new PDFReader();
>
> viewer.setVisible(true);
>
> }
>
> I opened file ktv1390898988640.pdf with the open menu and got this errors
>
> Exception in thread "AWT-EventQueue-1" java.lang.NoClassDefFoundError: 
> org/apache/fontbox/afm/AFMParser
>