• java.lang.NoSuchMethodError: com.itextpdf.text.pdf.PdfDiv.setKeepTogether(Z)V


    用com.itextpdf.text.Document打印pdf报错

    时间:2017-06-22 12:23:39,594 - 级别:[ERROR] - 消息: [other] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler processing failed; nested exception is java.lang.NoSuchMethodError: com.itextpdf.text.pdf.PdfDiv.setKeepTogether(Z)V] with root cause - 位置:org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet]:182
    java.lang.NoSuchMethodError: com.itextpdf.text.pdf.PdfDiv.setKeepTogether(Z)V
        at com.itextpdf.tool.xml.css.apply.DivCssApplier.apply(DivCssApplier.java:232)
        at com.itextpdf.tool.xml.html.CssAppliersImpl.apply(CssAppliersImpl.java:115)
        at com.itextpdf.tool.xml.html.CssAppliersImpl.apply(CssAppliersImpl.java:125)
        at com.itextpdf.tool.xml.html.Div.end(Div.java:105)
        at com.itextpdf.tool.xml.html.AbstractTagProcessor.endElement(AbstractTagProcessor.java:229)
        at com.itextpdf.tool.xml.pipeline.html.HtmlPipeline.close(HtmlPipeline.java:208)
        at com.itextpdf.tool.xml.XMLWorker.endElement(XMLWorker.java:142)
        at com.itextpdf.tool.xml.parser.XMLParser.endElement(XMLParser.java:397)
        at com.itextpdf.tool.xml.parser.state.ClosingTagState.process(ClosingTagState.java:71)
        at com.itextpdf.tool.xml.parser.XMLParser.parseWithReader(XMLParser.java:237)
        at com.itextpdf.tool.xml.parser.XMLParser.parse(XMLParser.java:215)
        at com.itextpdf.tool.xml.XMLWorkerHelper.parseXHtml(XMLWorkerHelper.java:174)

    导入的jar包版本不对不兼容,应该导入下面三个jar包

    itextpdf-5.5.9.jar
    itext-asian-5.2.0.jar
    xmlworker-5.5.9.jar

    maven

    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>itextpdf</artifactId>
        <version>5.5.9</version>
    </dependency>
    
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>itext-asian</artifactId>
        <version>5.2.0</version>
    </dependency>
    
    <dependency>
        <groupId>com.itextpdf.tool</groupId>
        <artifactId>xmlworker</artifactId>
        <version>5.5.9</version>
    </dependency>

    gradle

    compile group: 'com.itextpdf', name: 'itextpdf', version: '5.5.9'
    compile group: 'com.itextpdf', name: 'itext-asian', version: '5.2.0'
    compile group: 'com.itextpdf.tool', name: 'xmlworker', version: '5.5.9'

     

  • 相关阅读:
    2020.4.13 机器学习相关数学基础
    2020.3.30 机器学习概述
    12.18语法制导的语义翻译
    12.11算符优先分析
    12.4自下而上语法分析
    11.27实验二 递归下降语法分析
    11.20LL(1)文法的判断,递归下降分析程序
    11.13消除左递归
    4.K均值算法--应用
    3.K均值算法
  • 原文地址:https://www.cnblogs.com/skyessay/p/7065936.html
Copyright © 2020-2023  润新知