iText 7의 디지털 서명 백서 코드 예제는 iText 7 Java samples github repository 하위 폴더 /publications/signatures/에서 찾을 수 있습니다. 간단한 C2_01_SignHelloWorld 예에서 발췌 :
public void sign(String src, String dest,
Certificate[] chain,
PrivateKey pk, String digestAlgorithm, String provider,
PdfSigner.CryptoStandard subfilter,
String reason, String location)
throws GeneralSecurityException, IOException {
// Creating the reader and the signer
PdfReader reader = new PdfReader(src);
PdfSigner signer = new PdfSigner(reader, new FileOutputStream(dest), false);
// Creating the appearance
PdfSignatureAppearance appearance = signer.getSignatureAppearance()
.setReason(reason)
.setLocation(location)
.setReuseAppearance(false);
Rectangle rect = new Rectangle(36, 648, 200, 100);
appearance
.setPageRect(rect)
.setPageNumber(1);
signer.setFieldName("sig");
// Creating the signature
IExternalSignature pks = new PrivateKeySignature(pk, digestAlgorithm, provider);
IExternalDigest digest = new BouncyCastleDigest();
signer.signDetached(digest, pks, chain, null, null, null, 0, subfilter);
}
출처
2016-12-15 15:49:08
mkl
당신이 [iText를 7 자바 샘플 GitHub의 저장소]를 살펴 있었나요 (https://github.com/itext/i7js-samples)? 하위 폴더 [/publications/signatures/](https://github.com/itext/i7js-samples/tree/develop/publications/signatures)에는 iText 7에 포팅 된 백서 샘플이 들어 있습니다. – mkl
정말 고마워요. 아래에 답을 적어주십시오. –