pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: Reading PDF documents with images encoded in JPEG2000
Date Thu, 18 Jul 2019 18:28:21 GMT
Hi,

I've never tried a headless jdk. I don't know if it will build. You 
don't need to build from source if you're just testing your application, 
then just use pdfbox dependencies as described on the website.

Re the bug in the maven-compiler-plugin - try inserting/merging these in 
the plugin segment in your pom.xml to get more error messages:

                 <configuration>
                     <compilerArguments>
                         <verbose/>
                     </compilerArguments>
                     <verbose>true</verbose>
                 </configuration>

For example, the one in the pdfbox trunk looks like this on my machine:

             <plugin>
<artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
<showDeprecation>true</showDeprecation>
                     <target>1.7</target>
                     <source>1.7</source>
                     <encoding>UTF-8</encoding>
                     <compilerArguments>
                         <verbose/>
                     </compilerArguments>
                     <verbose>true</verbose>
                 </configuration>
             </plugin>


Tilman

Am 18.07.2019 um 15:12 schrieb Prakash Sabapathy:
> Regarding the mailing list, I initially subscribed to tika.apache.org. I was able to
send messages to users@pdfbox.apache.org however I could not receive any messages. I've since
subscribed to pdfbox.apache.org and I'm now receiving messages as well.
>
> I've upgraded to Debian buster and I've installed openjdk-11-jdk-headless and openjdk-11-jre-headless.
However I now cannot compile pdfbox and Maven reports failure at FontBox.
>
> The error message is given below.
>
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.0:compile
(default-compile) on project fontbox: Compilation failure -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.0:compile
(default-compile) on project fontbox: Compilation failure
>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
>      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
>      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
>      at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build
(SingleThreadedBuilder.java:56)
>      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
>      at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
>      at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
>      at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
>      at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
>      at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
>      at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
>      at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
>      at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
>      at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
>      at java.lang.reflect.Method.invoke (Method.java:566)
>      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
>      at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
>      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
>      at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
> Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation
failure
>      at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1033)
>      at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:137)
>      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
>      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
>      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
>      at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build
(SingleThreadedBuilder.java:56)
>      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
>      at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
>      at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
>      at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
>      at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
>      at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
>      at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
>      at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
>      at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
>      at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
>      at java.lang.reflect.Method.invoke (Method.java:566)
>      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
>      at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
>      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
>      at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
>
> Does PDFBox need Oracle Java instead?
>
> I'll try and setup a simple case as you've suggested over the weekend. I'm relatively
new at Java/Maven so it may take some time.
>
> Regards
> Prakash
>
> ________________________________
> From: Tilman Hausherr <THausherr@t-online.de>
> Sent: Thursday, 18 July 2019 2:51 AM
> To: users@pdfbox.apache.org
> Subject: Re: Reading PDF documents with images encoded in JPEG2000
>
> Hi,
>
> This is very mysterious. There are similar errors here, it seems to be
> jdk related:
> https://github.com/haraldk/TwelveMonkeys/issues/201
> https://github.com/haraldk/TwelveMonkeys/issues/357
>
> Make sure you have a current jdk version, e.g. the last publicly
> available jdk8 version, or jdk12.
>
> Also test without pdfbox, i.e. just try setting up a project with
>
> ImageIO.getImageReadersByFormatName("JPEG2000");
>
> and see what happens.
>
> Re mailing list: make sure you're subscribed. If you can't subscribe,
> please tell what you did.
>
> Tilman
>
> Am 17.07.2019 um 13:18 schrieb Prakash Sabapathy:
>> Hi Tilman,
>>
>> For reasons unknown I can only see your response under markmail.org. A copy of it
can be found below.
>>
>> I commented out the test scope (i.e. <!-- <scope>test</scope> -->)
under the dependency with groupId com.github.jai-imageio for artifactId jai-imageio-core and
jai-imageio-jpeg2000 in pom.xml files in the following directories:
>>
>> debugger
>> parent
>> pdfbox
>> tools
>>
>> This was using the source code in pdfbox-2.0.16-src.zip.
>>
>> When I run java -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider -jar app/target/pdfbox-app-2.0.16.jar
PDFToImage testwithimages.pdf, the error message I receive is:
>>
>> Jul 17, 2019 8:37:08 PM org.apache.pdfbox.pdmodel.font.PDTrueTypeFont <init>
>> WARNING: Using fallback font 'LiberationSans' for 'TimesNewRomanPSMT'
>> Exception in thread "main" java.util.ServiceConfigurationError: javax.imageio.spi.ImageWriterSpi:
Provider com.github.jaiimageio.jpeg2000.impl.J2KImageWriterSpi not found
>>           at java.util.ServiceLoader.fail(ServiceLoader.java:239)
>>           at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
>>           at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372)
>>           at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
>>           at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
>>           at javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(IIORegistry.java:210)
>>           at javax.imageio.spi.IIORegistry.<init>(IIORegistry.java:138)
>>           at javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:159)
>>           at javax.imageio.ImageIO.<clinit>(ImageIO.java:66)
>>           at org.apache.pdfbox.filter.Filter.findImageReader(Filter.java:151)
>>           at org.apache.pdfbox.filter.JPXFilter.readJPX(JPXFilter.java:115)
>>           at org.apache.pdfbox.filter.JPXFilter.decode(JPXFilter.java:64)
>>           at org.apache.pdfbox.cos.COSInputStream.create(COSInputStream.java:84)
>>           at org.apache.pdfbox.cos.COSStream.createInputStream(COSStream.java:175)
>>           at org.apache.pdfbox.cos.COSStream.createInputStream(COSStream.java:163)
>>           at org.apache.pdfbox.pdmodel.common.PDStream.createInputStream(PDStream.java:236)
>>           at org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.<init>(PDImageXObject.java:140)
>>           at org.apache.pdfbox.pdmodel.graphics.PDXObject.createXObject(PDXObject.java:70)
>>           at org.apache.pdfbox.pdmodel.PDResources.getXObject(PDResources.java:426)
>>           at org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:54)
>>           at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:869)
>>           at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:505)
>>           at org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:479)
>>           at org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:152)
>>           at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:263)
>>           at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:321)
>>           at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:243)
>>           at org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:229)
>>           at org.apache.pdfbox.tools.PDFToImage.main(PDFToImage.java:250)
>>           at org.apache.pdfbox.tools.PDFBox.main(PDFBox.java:89)
>>
>> The IDE is Visual Studio Code running in Windows 10 however the source code and Java
compiler etc (Oracle Java 8) are in Linux (Debian stretch) virtual machine (VirtualBox). I
compiled the source code with mvn clean install from a console in the virtual machine and
also executed it in the same console.
>>
>> Regards
>> Prakash
>>
>> Hi,
>>
>>
>> No java source code change is needed.
>>
>>
>> How does your pom.xml look?
>>
>>
>> What IDE are you using?
>>
>>
>> Please post the full stack trace. I'm surprised that the log mentions
>> "com.github.jaiimageio.jpeg2000.impl.J2KImageWriterSpi" but at the same
>> time claims that the JAI tools are not installed. But
>> "com.github.jaiimageio.jpeg2000" is the package of the tool on github.
>>
>>
>> Tilman
>>
>>
>> Am 16.07.2019 um 14:48 schrieb Prakash Sabapathy:
>>
>> Hi,
>>
>>
>> Are there any simple instructions for a novice in Java on how to suitably change
>> the source code of PDFBox to allow it to read PDF documents with images in
>> JPEG2000 format?
>>
>>
>> I've tried to change pom.xml under various directories (trial and error) and I
>> keep getting either of the following errors:
>>
>>
>> Exception in thread "main" java.util.ServiceConfigurationError:
>> javax.imageio.spi.ImageWriterSpi: Provider
>> com.github.jaiimageio.jpeg2000.impl.J2KImageWriterSpi not found
>>
>>
>> or
>>
>>
>> SEVERE: Cannot read JPEG2000 image: Java Advanced Imaging (JAI) Image I/O Tools
>> are not installed
>>
>>
>> Regards
>> Prakash
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message