首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >iText SpongyCastle错误

iText SpongyCastle错误
EN

Stack Overflow用户
提问于 2013-04-27 04:46:09
回答 1查看 1.9K关注 0票数 1

我已经尝试了各种版本的itext,包括带有试用许可证的itextgoogle,当我尝试运行我的代码时,我一直收到以下错误:

代码语言:javascript
复制
     InputStream object = this.getResources().openRawResource(R.raw.itextkey);
     LicenseKey.loadLicenseFile(object);
     Document document = new Document();
     try {
             PdfWriter.getInstance(document, new FileOutputStream(android.os.Environment.getExternalStorageDirectory() + java.io.File.separator + java.io.File.separator + "testPDF.pdf"));
             document.open();
             document.add(new Paragraph("testing"));
     } catch (DocumentException de) {
             System.err.println(de.getMessage());
     } catch (IOException ioe) {
             System.err.println(ioe.getMessage());
     }
     document.close();

错误是:

代码语言:javascript
复制
04-26 20:18:12.761: E/dalvikvm(1927): Could not find class 'org.spongycastle.cert.X509CertificateHolder', referenced from method com.itextpdf.text.pdf.PdfReader.readDecryptedDocObj
04-26 20:18:12.761: W/dalvikvm(1927): VFY: unable to resolve new-instance 2251 (Lorg/spongycastle/cert/X509CertificateHolder;) in Lcom/itextpdf/text/pdf/PdfReader;

我听说我需要自己构建iText,但我不确定从哪里开始/如何做。我找到的jars在它们的文件名中并不是很有描述性。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-04-27 05:12:23

SpongyCastle是安卓系统中可用的BouncyCastle加密库的替代方案。看看这个线程How to include the Spongy Castle JAR in Android?,它包含了如何将SpongyCastle库包含到项目中的详细信息。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16244956

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档