MaikJaek / flying-saucer

Automatically exported from code.google.com/p/flying-saucer
0 stars 0 forks source link

java.lang.NoSuchMethodError: com.lowagie.text.pdf.BaseFont.getCharBBox(C)[I with itext 2.1.7 #126

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
 InputStream convert(InputStream fileInputStream) {
        try{

        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setNamespaceAware(false);
        DocumentBuilder builder = factory.newDocumentBuilder();
        Document document = builder.parse(fileInputStream)

        ITextRenderer renderer = new ITextRenderer()
        renderer.setDocument(document,"")

        InputStream inputStream = new PipedInputStream()
        OutputStream outputStream = new PipedOutputStream( inputStream )
        renderer.createPDF( outputStream )
        }
        catch( DocumentException e ){
            e.printStackTrace()
        }
        return inputStream
    }

What is the expected output? What do you see instead?
Expected output is no exception. I see
java.lang.NoSuchMethodError: com.lowagie.text.pdf.BaseFont.getCharBBox(C)[I

What version of the product are you using? On what operating system?
R8 with itext 2.1.7

Original issue reported on code.google.com by StefanKe...@gmail.com on 14 Mar 2011 at 7:18

GoogleCodeExporter commented 8 years ago
Unfortunately there is a binary (but not source) incompatibility between iText 
2.0.x and iText 2.1.x.  In short, if you recompile R8 against iText 2.1.x / 4.x 
it will work fine.  master / HEAD uses iText 2.1.x too.

Original comment by Peter.Br...@gmail.com on 24 Mar 2011 at 1:02

GoogleCodeExporter commented 8 years ago
I'm not going to recompile. I only use maven-central deployed JARs; anything 
else would lead to madness. Is there a roadmap for the next release that will 
be deployed to maven central?

Original comment by StefanKe...@gmail.com on 24 Mar 2011 at 1:32

GoogleCodeExporter commented 8 years ago
This issue was reported almost two years ago and still not fixed.

http://java.net/jira/browse/XHTMLRENDERER-281

Original comment by ppet...@gmail.com on 28 Mar 2011 at 12:26

GoogleCodeExporter commented 8 years ago
I am also uncomfortable recompiling. Is there any movement on getting the 
binary updated any time soon?

Original comment by lee.c.george on 12 Oct 2011 at 10:38

GoogleCodeExporter commented 8 years ago
is there any chance that this issue will be solved?!

Original comment by hicham.g...@gmail.com on 14 Oct 2011 at 2:49

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I've download the head and I've compiled with ANT, and the core-render.jar and 
core-render-minimal.jar generated works fine with itext 2.1.7
But when I see the class "ITextFontResolver.java" I'm still seeing the 
"problematic call" to older versions of iText (2.0.x) 
"int[] box = _font.getCharBBox('x');"
But when it's is compiled and the JAR is generated, this invocation is changed 
in the bytecode (I've "decompilated" the ITextFontResolver.class inside of 
JAR), I don't have any idea how it's done, but believe me, it works!
Now I'm trying to understand how it's done but I don't see anything...
Anybody knows how is it works? using ANT? javassist? reflection? how?
Thanks and keep on working, your project is great!

Original comment by midireccion6@gmail.com on 11 Nov 2011 at 10:33

GoogleCodeExporter commented 8 years ago
I am with the same problem!

Original comment by jcguilhe...@gmail.com on 30 Dec 2011 at 7:25

GoogleCodeExporter commented 8 years ago
Recompiling with a replaced jar of itext 2.1.7 works. It seems this is already 
in the trunk.
It would be great if someone could deploy an updated version to the maven 
central repository.

Original comment by Benjamin...@gmail.com on 9 Feb 2012 at 10:24

GoogleCodeExporter commented 8 years ago
Checkout this link folks
http://wo-repository.doit.com.br/content/repositories/thirdparty/org/xhtmlrender
er/core-renderer/R8-final/

You would find the compiled core-renderer jar file hosted here.

Original comment by ashish.s...@gmail.com on 13 Feb 2012 at 9:08

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
If anybody still facing the problem I found the solution - you can use 
core-renderer-R8pre2.jar or core-renderer-R8.jar but itext version must be 
2.0.8 or less than only it works, above itext-2.0.8 any version it doesn't work.

Original comment by monty4u2...@gmail.com on 8 Mar 2012 at 4:36

GoogleCodeExporter commented 8 years ago
I can not understand why the Flying saucer team do not re-compile the sources 
so the application can work with latest version of Itext... (specially when the 
solution appears to be as simple as recompile the sources with another itext 
jar file...)

Original comment by JoSeTe4e...@gmail.com on 13 Mar 2012 at 8:34

GoogleCodeExporter commented 8 years ago
thanks ashish.s...@gmail.com i love you,the version of the comment 10 work 
great.

Original comment by cfe...@netco.la on 25 Apr 2012 at 9:07

GoogleCodeExporter commented 8 years ago
The version of the comment 10 work great, it would be nice to push it on 
http://mvnrepository.com/artifact/org.xhtmlrenderer/core-renderer.

Thanks by the way

Original comment by PierreAl...@gmail.com on 3 Oct 2012 at 8:48

GoogleCodeExporter commented 8 years ago
The link 
http://wo-repository.doit.com.br/content/repositories/thirdparty/org/xhtmlrender
er/core-renderer/R8-final/ in comment 10 is no longer working, can someone 
please point me to correct jar

Original comment by ankurmit...@gmail.com on 17 Nov 2012 at 6:43

GoogleCodeExporter commented 8 years ago
I ran into the above exception when evaluating FlyingSaucer for PDF generation. 
We use Maven to build the project, and I did not want to introduce a 
custom-built jar. Originally I added a dependency direct to FlyingSaucer.

<dependency>
   <groupId>org.xhtmlrenderer</groupId>
   <artifactId>flying-saucer-pdf</artifactId>
   <version>9.0.0</version>
</dependency>

This lead to the NoSuchMethodError. I'm in a rush to test this out, so by 
specifying older dependencies I was able to get things to work. To be clear, 
the following gets around the Exception but does not use the latest release.

<dependency>
            <groupId>org.xhtmlrenderer</groupId>
            <artifactId>core-renderer</artifactId>
            <version>R8pre2</version>
        </dependency>
        <dependency>
            <groupId>com.lowagie</groupId>
            <artifactId>itext</artifactId>
            <version>2.0.8</version>
        </dependency>

Original comment by my...@quimbik.com on 6 Dec 2012 at 10:25

GoogleCodeExporter commented 8 years ago
Is this fixed now? Which combination of latest maven version should I use now 
to not face this issue anymore?

Original comment by sunny.le...@gmail.com on 18 Sep 2014 at 5:08

GoogleCodeExporter commented 8 years ago
Not fixed, still having problem with flying saucer 9.0.7/iText 2.1.7

Original comment by tony.ben...@gmail.com on 12 Mar 2015 at 1:16

GoogleCodeExporter commented 8 years ago
Work with Flying Saucer 9.0.7/iText 4.2.1.

            <dependency>
                <groupId>org.xhtmlrenderer</groupId>
                <artifactId>flying-saucer-pdf</artifactId>
                <version>9.0.7</version>
            </dependency>
            <dependency>
                <groupId>com.lowagie</groupId>
                <artifactId>itext</artifactId>
                <version>4.2.1</version>
            </dependency>

Original comment by TheWrite...@gmail.com on 11 Jun 2015 at 5:00

GoogleCodeExporter commented 8 years ago
Works for me with version 9.0.7 
https://oss.sonatype.org/#nexus-search;quick~flying-saucer

Original comment by amy...@gmail.com on 12 Jun 2015 at 2:03