1

Id like to use PDFBox to generate PDF highlight files in my .net project. PDFBox states that it can be used in .net via IKVM http://www.pdfbox.org/userguide/dot_net.html

BUT running ikvmc (latest version) to generate the DLLs on PDFBOX.1.0.0.jar generates a whole lot of NoClassDefFound warnings.

How should I fix this, and what other DLLs do I need to include in my project? It seems as though file names have changed from the older documentation/articles I have read on the matter.

thanks in advance.

4

2 回答 2

1

我只是在尝试自己弄清楚如何让 PDFBox 1.0 正常工作时遇到了这个问题。似乎正在生成 NoClassFound 错误,因为它找不到引用的 jars(位于名为“external”的文件夹中)。以下是我最终能够让它工作的方式:

  1. 使用来自 IKVM 0.30.00 的二进制文件
  2. 将pdfbox-1.0.0 jar文件放到“external”文件夹下(更容易参考)
  3. 在命令行中,执行lkvmc.exe -target:library -out:"[Output Path]\netpdfbox.dll" "[PDFBox Path]\*.jar" <-- *.jar 告诉 IKVM 运行包含所有 jar 文件作为一个大型集会

您应该能够在 C# 代码中包含输出的 .dll。我能够毫无问题地执行以下代码:

PDDocument doc = PDDocument.load("test.pdf");
string output = new PDFTextStripper().getText(doc);
于 2010-03-22T20:09:36.560 回答
0

It depends on what version of PDFBox you are using. The latest releaesd version (0.7.3) uses IKVM 0.30.00. There are other versions of IKVM out there as well, and not all are backwards compatible. There is also another beta PDFBox that I believe uses a newer version of IKVM.

I'm pretty sure that the IKVM libraries that are required for each versioned release of PdfBox are in the release zip file. Be sure you use the one that comes with the release, and not the latest version of IKVM because they may not be compatible.

于 2010-02-22T22:31:07.287 回答