pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Ridao Freitas <i...@ivanrf.com>
Subject Re: PDFBox 2.0 and Batik
Date Tue, 10 May 2016 18:47:08 GMT
I use this code:

         SVGConverter converter = new SVGConverter();
         converter.setDestinationType(DestinationType.PDF);
         converter.setSources(new String[] { svg.getAbsolutePath() });
         converter.setDst(pdf);
         converter.execute();

with 'org.apache.xmlgraphics:batik-rasterizer:1.8' and 
'org.apache.xmlgraphics:fop:2.1' libs.

If I only include the Batik lib I get this exception:

    org.apache.batik.apps.rasterizer.SVGConverterException: Error:
    cannot access transcoder for image of type application/pdf
         at
    org.apache.batik.apps.rasterizer.SVGConverter.execute(Unknown Source)

When I add the FOP lib I get the exception I mentioned in my previous 
message:

    java.lang.NoSuchMethodError:
    org.apache.fontbox.cff.CFFFont.getProperty(Ljava/lang/String;)Ljava/lang/Object;
         at org.apache.fop.fonts.truetype.OTFFile.readName(OTFFile.java:134)
         at
    org.apache.fop.fonts.truetype.OpenFont.readFont(OpenFont.java:740)
         at
    org.apache.fop.fonts.truetype.OFFontLoader.read(OFFontLoader.java:109)
         at
    org.apache.fop.fonts.truetype.OFFontLoader.read(OFFontLoader.java:93)
         at org.apache.fop.fonts.FontLoader.getFont(FontLoader.java:124)
         at org.apache.fop.fonts.FontLoader.loadFont(FontLoader.java:108)
         at
    org.apache.fop.fonts.autodetect.FontInfoFinder.find(FontInfoFinder.java:254)
         at org.apache.fop.fonts.FontAdder.add(FontAdder.java:63)
         at
    org.apache.fop.fonts.FontDetectorFactory$DefaultFontDetector.detect(FontDetectorFactory.java:105)
         at
    org.apache.fop.fonts.FontManager.autoDetectFonts(FontManager.java:229)
         at
    org.apache.fop.fonts.DefaultFontConfigurator.configure(DefaultFontConfigurator.java:82)
         at
    org.apache.fop.svg.PDFDocumentGraphics2DConfigurator.createFontInfo(PDFDocumentGraphics2DConfigurator.java:104)
         at
    org.apache.fop.svg.PDFDocumentGraphics2DConfigurator.configure(PDFDocumentGraphics2DConfigurator.java:70)
         at
    org.apache.fop.svg.PDFTranscoder.transcode(PDFTranscoder.java:130)
         at
    org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown
    Source)
         at
    org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown
    Source)
         at
    org.apache.batik.apps.rasterizer.SVGConverter.transcode(Unknown Source)
         at
    org.apache.batik.apps.rasterizer.SVGConverter.execute(Unknown Source)

My mistake, the incompatible lib seems to be FOP.

Ivan

On 10/5/2016 2:52 p. m., John Hewson wrote:
> I don’t know how you’re using Batik, but problems with it are not related to PDFBox.
>
> — John


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message