[英]How to include iText to my project as a source code?
I have downloaded itext source code from here (downlaod snapshot). 我已经从这里下载了itext源代码(下载快照)。
However, I don't know how do I add it to my project so it would work... 但是,我不知道如何将其添加到我的项目中,以便它能正常工作...
If I add the com package, then resources are ommited. 如果添加com程序包,则资源将被省略。 If I add a package from higher level, all imports get messed up (it's fixable, but I don't know if there are other consequences). 如果我从更高级别添加一个软件包,那么所有导入都会陷入混乱(它是可修复的,但是我不知道是否还会有其他后果)。
But whatever I do, I don't have BouncyCastle jars that are needed so all iText classes would function properly, and I know it had some heavy API changes recently so I'm not sure what version is compatible with the version of iText on sourceForge that I downloaded. 但是无论我做什么,我都没有需要的BouncyCastle jar,因此所有iText类都可以正常运行,而且我知道它最近对API进行了一些重大更改,因此我不确定与sourceForge上的iText版本兼容的版本我下载的
I don't even know which and if I downloaded the right version... 我什至不知道哪个以及我是否下载了正确的版本...
Any advice? 有什么建议吗?
you've downloaded the source code. 您已经下载了源代码。 It's better to download the ZIP file from here: http://sourceforge.net/projects/itext/files/iText/iText5.4.3/ 最好从此处下载ZIP文件: http : //sourceforge.net/projects/itext/files/iText/iText5.4.3/
The zip file in this directory contains several jars. 此目录中的zip文件包含几个jar。 Normally you'll only need the itextpdf-5.4.3.jar to start with. 通常,您只需要使用itextpdf-5.4.3.jar即可。
The easiest way to build your project from the iText source code (should you wish to do that anyway), is to use the POM file. 从iText源代码构建项目的最简单方法(无论如何还是要这样做)是使用POM文件。 If you don't know what a POM file is, please search the net for Maven. 如果您不知道什么是POM文件,请在网上搜索Maven。 The POM file allows you to import the project as a Maven Project. POM文件允许您将项目导入为Maven项目。 This will automatically import all dependencies. 这将自动导入所有依赖项。 (Of course: now I'm assuming that you've installed Maven in Eclipse.) (当然:现在,我假设您已经在Eclipse中安装了Maven。)
The reason why the code doesn't compile when you download it, is simple: iText has a dependency on BouncyCastle and if you don't add BouncyCastle to your CLASSPATH, iText won't compile. 下载代码时无法编译的原因很简单:iText依赖于BouncyCastle,并且如果您不将BouncyCastle添加到CLASSPATH中,则iText不会编译。 At runtime, you only need BouncyCastle as soon as you need encryption (password encryption, certificate encryption, digital signatures). 在运行时,仅在需要加密(密码加密,证书加密,数字签名)后才需要BouncyCastle。
If you wait until Monday, you'll be able to download iText 5.4.4. 如果等到星期一,则可以下载iText 5.4.4。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.