XPS 문서에 서명 요청 추가
이 항목에서는 XPS 문서에 서명 요청을 추가하는 방법을 설명합니다. 서명 요청은 서명 의도에 동의하는 경우 사용자에게 문서에 서명하라는 메시지를 표시합니다.
프로그램에서 다음 코드 예제를 사용하기 전에 Common Digital Signature Programming Tasks의 고지 사항을 읽어 줍니다.
XPS 문서에 서명 요청을 추가하려면 다음을 수행합니다.
- 서명 관리자 초기화에 설명된 대로 XPS 문서를 서명 관리자에 로드합니다.
- 서명 관리자에 서명 블록을 추가합니다.
- 새 서명 블록에서 서명 요청을 만듭니다.
- 서명 요청의 속성을 설정합니다.
- 서명 의도를 설정합니다.
- 서명이 요청된 사람(요청된 서명자)의 이름을 설정합니다.
- 서명이 필요한 날짜를 설정합니다.
- 필요에 따라 다른 서명 속성을 설정합니다.
다음 코드 예제에서는 XPS 문서에 서명 요청을 추가하는 방법을 보여 줍니다.
HRESULT
AddSignatureRequestToDocument (
__in IXpsSignatureManager *signatureManager,
__in LPCWSTR reasonForSignatureRequest,
__in LPCWSTR nameOfRequestedSigner,
__in LPCWSTR requestSignByDate
)
{
HRESULT hr = S_OK;
IXpsSignatureBlock *signatureDefinition = NULL;
IXpsSignatureRequest *signatureRequest = NULL;
// Create a new signature block and get a pointer to it
hr = signatureManager->AddSignatureBlock (NULL, 0, &signatureDefinition);
if (SUCCEEDED(hr)) {
// Create a new signature request to use for this signature block
hr = signatureDefinition->CreateRequest(NULL, &signatureRequest);
}
if (SUCCEEDED(hr)) {
// Initialize the properties of the signature request
// Set the string that describes the purpose of the signature
// to the person who will sign the document.
hr = signatureRequest->SetIntent(reasonForSignatureRequest);
}
if (SUCCEEDED(hr)) {
// Set the name of the person whose signature is requested.
hr = signatureRequest->SetRequestedSigner(nameOfRequestedSigner);
}
if (SUCCEEDED(hr)) {
// Set the date that the person should sign the document.
// The person is requested to sign the document on or before
// the date specified in this field. Refer to the help text
// for the correct format of this string.
hr = signatureRequest->SetRequestSignByDate(requestSignByDate);
}
if (NULL != signatureDefinition) signatureDefinition->Release();
if (NULL != signatureRequest) signatureRequest->Release();
return hr;
}
관련 항목
-
이 섹션에서 사용됨
-
상세 설명