use*_*551 1 android bouncycastle itext spongycastle
我已尝试使用各种版本的itext,包括带有试用许可证的itextgoogle,当我尝试运行我的代码时,我不断收到以下错误:
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();
Run Code Online (Sandbox Code Playgroud)
错误是:
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;
Run Code Online (Sandbox Code Playgroud)
我听说我需要自己构建iText,但我不知道从哪里开始/如何做到这一点.我发现的罐子的文件名不是很具描述性.
SpongyCastle是Android中可用的BouncyCastle加密库的替代品.看看这个主题 - 如何在Android中包含Spongy Castle JAR?其中详细介绍了如何将SpongyCastle库包含在项目中.
| 归档时间: |
|
| 查看次数: |
1809 次 |
| 最近记录: |