2014-02-14 31 views
1

我的問題是,我不能移動到最後一條語句,那就是echo語句。 pdf簽名者給出正確的輸出,但執行停止在$ signer-> sign($ module);'在pdf中使用SetaPDF-Signer的pdf簽名者

我如何可以移動到是echo語句

我的代碼下面給出的下一個語句...

require_once('SetaPDF-Signer/library/SetaPDF/Autoload.php'); 

// configure the temporary writer 
SetaPDF_Core_Writer_TempFile::setTempDir('SetaPDF-Signer/demos'); 

// create a writer 
$writer = new SetaPDF_Core_Writer_Http('235.pdf', true); 
// create a new document instance 
$document = SetaPDF_Core_Document::loadByFilename(
    'SetaPDF-Signer/235.pdf', $writer 
); 

// create a signer instance 
$signer = new SetaPDF_Signer($document); 

// set some signature properties 
$signer->setReason('needs to provide this '); 
$signer->setLocation('needs to provide this'); 

// create a signature module 
$module = new SetaPDF_Signer_Signature_Module_OpenSsl(); 
// load the certificate 
$certificate = file_get_contents('xxxxxxxxx.pem'); 
$module->setCertificate($certificate); 
$module->setPrivateKey(array($certificate, 'xxxxxxxxxx' /* no password */)); 

// sign the document and send the final document to the initial writer 
$signer->sign($module); 


echo "welcome"; 

回答

1

你必須選擇另一位作家的實例,不會自動發送產生文件給客戶瀏覽器。例如: -

$writer = new SetaPDF_Core_Writer_File('path/to/235.pdf'); 

,而不是

$writer = new SetaPDF_Core_Writer_Http('235.pdf', true); 

在SetaPDF所有可用的作家類的概述,請here