gpt4 book ai didi

pdf - 当字体自动检测启用时,FOP 给出 NoSuchMethodError

转载 作者:行者123 更新时间:2023-12-05 01:20:46 24 4
gpt4 key购买 nike

从 Apache FOP 生成 PDF 时出现以下错误,

  FopFactory fopFactory = FopFactory.newInstance(new File("/Users/vinurip/cloud/Stripe/Full/pdfboxtut/src/main/resources/fop.xconf"));
OutputStream out = new BufferedOutputStream(new FileOutputStream(new File(outFile)));
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out);

OutFile 是一个空的 pdf 文件位置。 fop.xconf 与 FOP 源中的相同
  Exception in thread "main" 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.render.PrintRendererConfigurator.getCustomFontCollection(PrintRendererConfigurator.java:147)
at org.apache.fop.render.PrintRendererConfigurator.setupFontInfo(PrintRendererConfigurator.java:127)
at org.apache.fop.render.intermediate.IFUtil.setupFonts(IFUtil.java:170)
at org.apache.fop.render.intermediate.IFRenderer.setupFontInfo(IFRenderer.java:187)
at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:75)
at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:350)
at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
at org.apache.fop.apps.Fop.<init>(Fop.java:78)
at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:182)
at org.apache.fop.apps.FopFactory.newFop(FopFactory.java:220)
at foptest.fo2PDF(foptest.java:73)
at foptest.main(foptest.java:57)

此问题似乎仅在启用字体自动检测时发生

最佳答案

您可以使用搜索引擎找到一些信息 - 例如。 https://qnalist.com/questions/6434450/pdfbox-2-0-and-batik - 虽然这些都不是很有用...

我的解决方法是使用 <directory recursive="true">/usr/share/fonts</directory>而不是 <auto-detect /> .

关于pdf - 当字体自动检测启用时,FOP 给出 NoSuchMethodError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41501641/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com