Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
443 views
in Technique[技术] by (71.8m points)

itext7 - iText 7 java.lang.NoSuchMethodError

I just started developing a new function to convert HTML page to PDF. I use iText 7. Followed the instruction here!.

And now i get the error Exception in thread "main" java.lang.NoSuchMethodError: com.itextpdf.layout.font.FontSet.getFonts()Ljava/util/Set;

I have created pom.xml following the instruction here! but still received the same error.

I use eclipse. I put the pom.xml in the WebContent folder and received the error. Same result when moved the pom.xml into the WEB-INF folder.

Is the directory for the pom.xml wrong?

I've gone through the question here! and also here! but still doesn't work

Please advice.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

pdfHTML 1.0.0 is not compatible with iText Core 7.0.3, it is only compatible with iText Core 7.0.2. Please refer to the compatibility matrix on GitHub for details: https://github.com/itext/itext7/releases/tag/7.0.3

iText Core 7.0.4 and pdfHTML 1.0.1, scheduled to be released together later this month, will also be compatible.

Meanwile if you want to use snapshot builds, you can add this to your pom.xml and use iText Core 7.0.4-SNAPSHOT and pdfHTML 1.0.1-SNAPSHOT:

<repositories>
  <repository>
    <id>itext-snapshots</id>
    <name>iText Repository - snapshots</name>
    <url>https://repo.itextsupport.com/snapshots</url>
    <snapshots>
      <enabled>true</enabled>
    </snapshots>
  </repository>
</repositories>

Use at your own risk, because snapshot builds are unsupported and are only for experienced developers who are willing to contribute to iText by following the latest development and submitting pull requests.

NEVER USE SNAPSHOT BUILDS IN A PRODUCTION ENVIRONMENT

Or just wait until the end of the month, when you can use iText Core 7.0.4 and pdfHTML 1.0.1.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...