简体   繁体   English

如何将iText作为源代码包含到我的项目中?

[英]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.

相关问题 如何在Eclipse项目中包含Java包源代码 - How to include Java package source code in an Eclipse project Intellij,如何在我自己的项目中使用 .class(不含源代码) - Intellij, how to use a .class(without source code) in my own project 与 SVN Eclipse 共享项目时,如何包含源文件/代码? - How do you include source file/code when sharing a Project with SVN Eclipse? 如何使用pdf生成代码导出日食项目(itext) - How to Export an eclipse project with pdf generation code(itext) 如何在Eclipse中包含Java源代码? - How to include Java Source code within Eclipse? 如何包含依赖关系的 Javadoc 和源代码 - How to include Javadoc and source code with dependency 在我的项目中构建和重用android开源Dialer源代码 - Build and reuse android open source Dialer source code in my project 我可以在与主类相同的源代码中包含类吗? - Can I include classes in the same source code as my main class? 如何将cardslib包含到我的Android项目中? - How to include cardslib to my Android project? 如何在编译之前修改 Gradle 项目中的 Java 源代码而不修改磁盘上的文件? - How can I modify Java source code in my Gradle project prior to compilation without modifying the files on disk?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM